Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I have the following query in SQL:
SELECT COUNT(a.CurrentVal) / b.[Count] AS NormalizedCount ,a.[HType] ,a.[YearW] ,a.[OS] FROM TableA AS a INNER JOIN TableB AS b ON a.HType = b.HType AND a.OS = b.OS AND a.YearW = b.YearW GROUP BY a.YearW, a.HType, a.OS, b.[Count] ORDER BY a.YearW
I wanted to create a measure/column/table in PowerBI Desktop for the above query after importing the two tables. I have explored the Summarize function but I dont seem to get it completely. Also, count function of DAX only counts the date or whole number. What would be a query to get the data for count using group by as indicated by the above query? Help on this is greatly appreciated.
Solved! Go to Solution.
If you want to return the same table that your SQL-table returns, this might be easier to do in the query editor.
Easiest would actually be to pass that SQL-statement into the optional SQL-statement box when you connect to your server:
But this is normally not a good practice, as your query probably wouldn’t fold then.
So if your query is too slow, you should use the M-code (that is produced when you use the UI in the query editor).
Advantage here is that you can connect on multiple fields, so no need to create a concatenated column.
In your example it would go like this:
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
You can't join on multiple columns in Power Pivot. You need a unique key on your dim table and a matching key in the fact table. Try importing the 2 tables and creating a unique key in your load queries by concatenating the columns. Then create a 1 to many join on the key.
Once the tables are loaded and joined, then please clarify the measure requirement
If you want to return the same table that your SQL-table returns, this might be easier to do in the query editor.
Easiest would actually be to pass that SQL-statement into the optional SQL-statement box when you connect to your server:
But this is normally not a good practice, as your query probably wouldn’t fold then.
So if your query is too slow, you should use the M-code (that is produced when you use the UI in the query editor).
Advantage here is that you can connect on multiple fields, so no need to create a concatenated column.
In your example it would go like this:
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
85 | |
65 | |
51 | |
45 |
User | Count |
---|---|
217 | |
88 | |
81 | |
65 | |
56 |