Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello! I am looking to achieve similar SQL query in PowerQuery M language/code
I know its simple in DAX using 'CALCULATE' function but all the data needs to be imported to report
I am dealing with the huge amount of 'Factless Fact Table data' and can't really efford to load everything to the report which is exceeding the PowerBI PRO size limits
Tried DirectQuery but facing performance issues (my source is Azure MSSQL DB General Purpose: Gen5, 2 vCores). Any suggestions on performance tuning is also welcome
But I really need help on PowerQuery, appreciate in advance
EXMAPLE QUERY-1
SELECT
COUNT( DISTINCT Id ) AS Assigned,
COUNT( DISTINCT Id + IIF( Response=1, '1', null )) AS Processed,
COUNT( DISTINCT Id + IIF( Response=0 AND IsDuplicate=1, '1', null )) AS Duplicate
FROM TABLE WITH (NOLOCK)
WHERE Category='xyz' AND CustomerId=123 AND Type='I' AND Status IN (1,2,3) AND [Date] BETWEEN '2021-06-01' and '2021-06-02'
EXMAPLE QUERY-2
SELECT
COUNT( DISTINCT Id ) AS Assigned,
COUNT( DISTINCT CASE WHEN Response=1 THEN Id ELSE NULL END) AS Processed,
COUNT( DISTINCT CASE WHEN Response=0 AND IsDuplicate=1 THEN Id ELSE NULL END) AS Duplicate
FROM TABLE WITH (NOLOCK)
WHERE Category='xyz' AND CustomerId=123 AND Type='I' AND Status IN (1,2,3) AND [Date] BETWEEN '2021-06-01' and '2021-06-02'
Lastly, I have tried most of the Azure performance techniques and PowerQuery community for M code but am unlucky.
@praveenlc I really don't know what you are trying to achieve and why PQ? Didn't @selimovd reply solved that you run these queries directly with fixed value? Am I missing something in your question?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@praveenlc or you can explore dynamic PQ Parameters that way you don't have to live with the fixed value data.
Dynamic M query parameters in Power BI Desktop (preview) - Power BI | Microsoft Docs
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to 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.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thanks @parry2k , its a good option totally fits my situation and I am exploring it.
And I am still crazy to achieve this in PowerQuery M code for my knowledge, any help here? 🙂
@praveenlc you can also just select your table without SQL statement and try to do the transformations in PowerQuery if you like the challenge
Hey @praveenlc ,
why don't you use the SQL statement in DirectQuery mode?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
88 | |
68 | |
61 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |