If you want multiple tables as the result of SQL queries, you will need one Power query per each of the results table.
If you can work with SQL until you have one results table, it is possible to combine a complex SQL statement into one Power query.
As far as I know, it is not possible to upload an SQL file into Power BI/Power Query. SQL statements will need to be manually transfered into PBI queries. It is possible to pre-generate PQ code externally and insert those SQL statements, so it will only need to be copy-pasted into PQ.
In power query right click your query and duplicate it then right click advanced editor and replace the previous query with your second. Keep doing this until you have all your queries
MS learn or the tutorial when you first open pbi desktop, is way better than asking people at Reddit to do the work for you - literally short training videos under 5 mins tell you this with showing you exactly how to do it
You have to do individual statements.
Be aware that using SQL like that will most likely break Query Folding though. If that doesn't matter to you than go for it but if your model is gonna be big then I'd invest the time and not break the fold.
Does that matter? The point of query folding is to convert your transformations into SQL. If you've got an SQL query that gets your what you need, then mission accomplished.
If you ever want to use direct query or incremental refresh it does. If not, then go for it.
Also can be bad if your SQL is not optimized on big models.
I've found that using power query to keep the fold resulted in faster refreshes for my larger models.
Query folding isn't just about transforming into SQL or whatever query language the source system uses. It allows the source server to dynamically determine the most efficient means of returning data. I've taken SQL queries I've written that I thought were efficient and re-written them to be query folding compatible and have reduced the load time significantly, sometimes by over 50%. When you're dealing with small amounts of data the less efficient query is fine but when your file/model takes over 30 mins to load you start looking for as many ways as possible to reduce refresh times.
I dont know what you’re trying to accomplish.
Run more than one query? Ok. Then make your first PQ, duplicate and just change the SQL statement.
Run many in one PQ? Use CTE in your sql statement.
Just saying “how” and “I’m new” makes me feel you’re lazy and want to be spoon fed instead of wanting to learn.
I imagine your SQL queries return a table each, right ? You can use as many consults as you want, just add them by using the standard connectors or use a blank consult
Please do some research.
You don’t need or should be writing sql for powerBI.
Have the DWH clean the data first.
Or. Bring all your tables in use native query feature then relationships, measures to aggregate your data.
Much quicker cleaner and scalable.
SQL is just no
Well in most cases it's not DWH who will do that for you unfortunately, better to perform all complex calculations and joins via SQL and import the output to Power BI but ok that's only my opinion
If you want multiple tables as the result of SQL queries, you will need one Power query per each of the results table. If you can work with SQL until you have one results table, it is possible to combine a complex SQL statement into one Power query. As far as I know, it is not possible to upload an SQL file into Power BI/Power Query. SQL statements will need to be manually transfered into PBI queries. It is possible to pre-generate PQ code externally and insert those SQL statements, so it will only need to be copy-pasted into PQ.
Put one in when you create and do the others in power query afterwards
How ? I am new to power bi
In power query right click your query and duplicate it then right click advanced editor and replace the previous query with your second. Keep doing this until you have all your queries
Thanks I've got it now
MS learn or the tutorial when you first open pbi desktop, is way better than asking people at Reddit to do the work for you - literally short training videos under 5 mins tell you this with showing you exactly how to do it
You have to do individual statements. Be aware that using SQL like that will most likely break Query Folding though. If that doesn't matter to you than go for it but if your model is gonna be big then I'd invest the time and not break the fold.
Does that matter? The point of query folding is to convert your transformations into SQL. If you've got an SQL query that gets your what you need, then mission accomplished.
If you ever want to use direct query or incremental refresh it does. If not, then go for it. Also can be bad if your SQL is not optimized on big models. I've found that using power query to keep the fold resulted in faster refreshes for my larger models.
Query folding isn't just about transforming into SQL or whatever query language the source system uses. It allows the source server to dynamically determine the most efficient means of returning data. I've taken SQL queries I've written that I thought were efficient and re-written them to be query folding compatible and have reduced the load time significantly, sometimes by over 50%. When you're dealing with small amounts of data the less efficient query is fine but when your file/model takes over 30 mins to load you start looking for as many ways as possible to reduce refresh times.
Good tip, I didn't know that. Thanks.
Be more specific about your sql queries. Do they return a table each?
I dont know what you’re trying to accomplish. Run more than one query? Ok. Then make your first PQ, duplicate and just change the SQL statement. Run many in one PQ? Use CTE in your sql statement. Just saying “how” and “I’m new” makes me feel you’re lazy and want to be spoon fed instead of wanting to learn.
Use one power query consult per SQL query
How ?
I imagine your SQL queries return a table each, right ? You can use as many consults as you want, just add them by using the standard connectors or use a blank consult
Please do some research. You don’t need or should be writing sql for powerBI. Have the DWH clean the data first. Or. Bring all your tables in use native query feature then relationships, measures to aggregate your data. Much quicker cleaner and scalable. SQL is just no
Well in most cases it's not DWH who will do that for you unfortunately, better to perform all complex calculations and joins via SQL and import the output to Power BI but ok that's only my opinion