The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Relative PBI noob here. I am having issues writing a dax calculation that counts the users correctly based on an overall status when a field is filtered to more than one value. The expectation here is that if Name is filtered for one or more value, an overall % complete and overall status is determined based off the filter.
This is the sample data:
DvUser | Name | DvState |
Aamir S | Orientation | Assigned |
Aamir S | Simulation | Enrolled |
Aaron H | Orientation | In Progress |
Aaron H | Simulation | Enrolled |
Aaron L | Orientation | Completed |
Aaron L | Simulation | Completed |
Aaron S | Orientation | Completed |
Aaron S | Quick Start | Assigned |
Aaron S | Simulation | Completed |
I have a measure that calculates Overall Percentage Complete based on the DvState as follows:
Thanks for the support. How do I ensure I have the correct visual setup in Power BI to display the results as expected? I am still unable to drag Overall Status to the legend?
It appears that you are trying to calculate an overall status and count distinct DvUsers based on the filter selections in your Power BI report, and you are encountering an issue where some DvUsers are being counted multiple times. To achieve the desired results, you need to adjust your DAX measures.
Here's a revised approach to calculate the distinct counts of DvUsers based on the filtered Name values and their corresponding overall status:
Overall Percentage Complete =
VAR FilteredNames = VALUES('sample frED data forPBI'[Name])
RETURN
DIVIDE(
SUMX(FILTER('sample frED data forPBI', 'sample frED data forPBI'[Name] IN FilteredNames),
SWITCH(
'sample frED data forPBI'[DvState],
"Completed", 1,
"In Progress", 0.1,
0
)),
COUNTROWS(FilteredNames),
0
)
In this measure, we calculate the Overall Percentage Complete by filtering the data based on the selected Name values and then summing the weighted counts.
Overall Status = VAR OverallPctComplete = [Overall Percentage Complete] RETURN IF( OverallPctComplete = 1, "Completed", OverallPctComplete = 0, "Not Started", "In Progress" )
This measure calculates the Overall Status based on the Overall Percentage Complete measure you've already defined.
With this approach, the distinct counts of DvUsers for each Overall Status should be calculated correctly based on the filtered Name values. Ensure that you have the correct visual setup in Power BI to display the results as expected.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
21 | |
18 | |
18 | |
15 | |
13 |
User | Count |
---|---|
41 | |
35 | |
22 | |
22 | |
17 |