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.
Hi,
I have data like this (see below)
And would like to have a Dax query in Power Bi to have the output like this: (See below)
Help!!
Solved! Go to Solution.
First, I'd learn about PROPER MODEL DESIGN (star schema).
Second, I'd denormalize the table (unpivot it in Power Query).
Then, I'd create a Date table the way it should be and connect it to the main table (with the names).
Then, I'd write a very simple DAX measure to compute what you want.
The table, Actions, would be:
Name,Action,Date
Name1,Senttweet,7/13/2019
Name2,Senttweet,7/7/2019
...
Then you'd have the Date table and would join it to the above on the Date field (which would be present in both tables). The Date table must be A PROPER DATE TABLE (not just any table, please read about a proper date table in Power BI).
If you do the above, then your DAX will be clean, fast and easy to understand/maintain. It'll be this:
[Qty] = COUNTROWS( Actions )
-- add 0 to this to show 0's instead of BLANKS, like this:
[Qty] = COUNTROWS( Actions ) + 0
You then should hide the Date column in the Actions table and slice by time only using the Date table.
Best
Darek
First, I'd learn about PROPER MODEL DESIGN (star schema).
Second, I'd denormalize the table (unpivot it in Power Query).
Then, I'd create a Date table the way it should be and connect it to the main table (with the names).
Then, I'd write a very simple DAX measure to compute what you want.
The table, Actions, would be:
Name,Action,Date
Name1,Senttweet,7/13/2019
Name2,Senttweet,7/7/2019
...
Then you'd have the Date table and would join it to the above on the Date field (which would be present in both tables). The Date table must be A PROPER DATE TABLE (not just any table, please read about a proper date table in Power BI).
If you do the above, then your DAX will be clean, fast and easy to understand/maintain. It'll be this:
[Qty] = COUNTROWS( Actions )
-- add 0 to this to show 0's instead of BLANKS, like this:
[Qty] = COUNTROWS( Actions ) + 0
You then should hide the Date column in the Actions table and slice by time only using the Date table.
Best
Darek
Thanks so much!
After I have unpivoted those columns ('action'), it all made sense and was easy! (I am new to Power Bi)
thanks again.
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 |
---|---|
42 | |
21 | |
21 | |
14 | |
13 |
User | Count |
---|---|
43 | |
39 | |
33 | |
18 | |
17 |