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 trying to write a dax for a table where I am planning on showing the percentage for the 3 groups that I have. So I want the data to look like this:
Group | Distinct Events | % of events |
A | 6000 | 28% |
B | 10000 | 48% |
C | 5000 | 24% |
Total | 21000 | 100% |
I have a slicer right beside this tabe where I have the 3 groups listed. The problem is, when I click on one of the groups, the data shows up like this:
Group | Distinct Events | % of events |
A | 6000 | 100% |
Total | 6000 | 100% |
I created a measure using the Event ID like this:
Distinct Events = DISTINCTCOUNT(Event[EventID])
I used this measure in the table and used the same measure again and clicked "show value as percentage of grand total". I am wondering, is there a way that I can create a dax measure for the percentage values only for "% of events" so that when I click on one of the groups in the slicer, it will show the correct percentage. For example if I click group A, it will show up as:
Group | Distinct Events | % of events |
A | 6000 | 28% |
Total | 6000 | 28% |
If someone could please help me create that measure, that would be much appreciated. Thank you
Solved! Go to Solution.
Try:
% of events =
DIVIDE(
DISTINCTCOUNT(Event[EventID]),
CALCULATE( DISTINCTCOUNT(Event[EventID] ), ALL(Event[EventID]))
)
Proud to be a Super User!
Paul on Linkedin.
Try:
% of events =
DIVIDE(
DISTINCTCOUNT(Event[EventID]),
CALCULATE( DISTINCTCOUNT(Event[EventID] ), ALL(Event[EventID]))
)
Proud to be a Super User!
Paul on Linkedin.
@PaulDBrown Thanks I tried the dax that you created, except, it still gave me 100% for all the groups even after choosing one of the groups in the slicer but when I removed the last event ID from the dax, it worked, I will still accept your response as the solution 🙂
I was wondering if you could explain the difference between ALL and ALLSELECTED?
% of events =
DIVIDE(
DISTINCTCOUNT(Event[EventID]),
CALCULATE( DISTINCTCOUNT(Event[EventID] ), ALL(Event))
)
Apologies, my mistake. It should have been:
% of events =
DIVIDE(
DISTINCTCOUNT(Event[EventID]),
CALCULATE( DISTINCTCOUNT(Event[EventID] ), ALL( Table [Group] ))
)
Proud to be a Super User!
Paul on Linkedin.
@PaulDBrown should it be "ALL( Event [Group] )" or "ALL(Event)"? Because it works when I don't specifcy a particular column
If ALL(Event) works, go for it!!
Proud to be a Super User!
Paul on Linkedin.
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 |
---|---|
110 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |