Forum Discussion
SQL script runs twice after changing parameters
- 6 years ago
mq2020 instead of having a script in pq, load view/table from the backend filter the table with a parameter, and with query folding it will send back the query to backend.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡
- 6 years ago
I think this blog post might be able to help.
https://blog.crossjoin.co.uk/2020/07/05/why-is-power-bi-running-my-sql-query-twice/
mq2020 instead of having a script in pq, load view/table from the backend filter the table with a parameter, and with query folding it will send back the query to backend.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡
- mq20206 years agoHelper III
parry2k and jdbuchanan71 , thank you for your posts.
It took me a while to get my head around it but I have now tested it and it seems to be working 🙂
For reference to other users, I have added the following syntax to my query in the Advance Editor view and just make sure the data types were according to my own queries.
letSource = Sql.Database("servername","databasename",[Query= "existingquerysyntax "]),OverrideZeroRowFilter = Table.View(null,[GetType = () => type table[Column1Name = Int32.Type,Column2Name = DateTime.Type,Column3Name = Byte.Type,Column4Name = Text.Type], GetRows = () => Source, OnTake= (count as number) =>if count = 0then #table(GetType(), {})else Table.FirstN(Source, count)])inOverrideZeroRowFilter