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 there!
I have a dataset that looks like the following:
ID | Employee | Hours | Cause |
F544.070 | Employee 1 | 1 | Fire |
F544.070 | Employee 2 | 2 | Fire |
F544.070 | Employee 3 | 1 | Fire |
F544.070 | Employee 4 | 2 | Fire |
F544.070 | Employee 5 | 3 | Fire |
F544.070 | Employee 6 | 1 | Fire |
L322.020 | Employee 1 | 1 | Storm |
L322.020 | Employee 2 | 3 | Storm |
L322.020 | Employee 3 | 4 | Storm |
L322.021 | Employee 1 | 1 | Tornado |
L322.021 | Employee 2 | 2 | Tornao |
L322.021 | Employee 3 | 3 | Tornado |
L322.021 | Employee 4 | 5 | Tornado |
L322.021 | Employee 5 | 4 | Tornado |
There is a unique ID an Emplyee, the hours they worked, and the incident responded too.
For reporting purposes we would like to find out how many fire calls there were last month. Unfortuneately it shows that there were 6 fire incidents instead of one. Is there a way to filter/calculate this so it is only returning one instance?
Solved! Go to Solution.
Why not simply create a matrix with values as a distinctcount?
Click the Matrix Visual button - drag Cause to the Rows - drag ID to the Values - click on ID and select Count (Distinct)
Thats it!
Try this:
Fire Calls = CALCULATE(DISTINCTCOUNT(ID), Cause = "Fire")
Hey Joe - taking a step further, say I wanted to return the correct count for all of our emergency categories?
Then I would create a measure that is simply All Emergencies = DISTINCTCOUNT(ID)
Hey Joe, thank you for the response! However is the data looks like this:
ID | Employee | Hours | Cause |
F544.070 | Employee 1 | 1 | Fire |
F544.070 | Employee 2 | 2 | Fire |
F544.070 | Employee 3 | 1 | Fire |
F544.070 | Employee 4 | 2 | Fire |
F544.070 | Employee 5 | 3 | Fire |
F544.070 | Employee 6 | 1 | Fire |
L322.020 | Employee 1 | 1 | Storm |
L322.020 | Employee 2 | 3 | Storm |
L322.020 | Employee 3 | 4 | Storm |
L322.021 | Employee 1 | 1 | Tornado |
L322.021 | Employee 2 | 2 | Tornado |
L322.021 | Employee 3 | 3 | Tornado |
L322.021 | Employee 4 | 5 | Tornado |
L322.021 | Employee 5 | 4 | Tornado |
L322.022 | Employee 1 | 1 | Fire |
L322.022 | Employee 2 | 1 | Fire |
L322.022 | Employee 3 | 2 | Fire |
L322.022 | Employee 4 | 3 | Fire |
L322.022 | Employee 5 | 2 | Fire |
L322.023 | Employee 1 | 1 | Storm |
L322.023 | Employee 2 | 2 | Storm |
L322.023 | Employee 3 | 3 | Storm |
returning the distrinct count will not tell me how many fire calls, storm call, etc etc I got last month. In the above data I can tell I got 2 fire calls and 2 storm calls because they occur under seperate IDs. I am sorry I wan't more clear from the beginning!
Why not simply create a matrix with values as a distinctcount?
Hey Michael - How would I go about doing that?
Click the Matrix Visual button - drag Cause to the Rows - drag ID to the Values - click on ID and select Count (Distinct)
Thats it!
Hey ! Thank you! I think I have been staring at this for WAY too long. It just clicked in my head right before you posted. That is of course the correct solution. Thank you!!!!
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 |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
101 | |
86 | |
64 |