Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Js112233
Helper I
Helper I

Returning Count of Incidents

Hello there! 

 

I have a dataset that looks like the following:

IDEmployeeHoursCause
F544.070Employee 11Fire
F544.070Employee 22Fire
F544.070Employee 31Fire
F544.070Employee 42Fire
F544.070Employee 53Fire
F544.070Employee 61Fire
L322.020Employee 11Storm
L322.020Employee 23Storm
L322.020Employee 34Storm
L322.021Employee 11Tornado
L322.021Employee 22Tornao
L322.021Employee 33Tornado
L322.021Employee 45Tornado
L322.021Employee 54Tornado

 

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?

3 ACCEPTED SOLUTIONS
JoeSQL
Frequent Visitor

Try this:

 

Fire Calls = CALCULATE(DISTINCTCOUNT(ID), Cause = "Fire")

View solution in original post

Why not simply create a matrix with values as a distinctcount?

View solution in original post

Sean
Community Champion
Community Champion

@Js112233

Click the Matrix Visual button - drag Cause to the Rows - drag ID to the Values - click on ID and select Count (Distinct)

 

Matrix Visual.png

 

Thats it! Smiley Happy

View solution in original post

8 REPLIES 8
JoeSQL
Frequent Visitor

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:

 

IDEmployeeHoursCause
F544.070Employee 11Fire
F544.070Employee 22Fire
F544.070Employee 31Fire
F544.070Employee 42Fire
F544.070Employee 53Fire
F544.070Employee 61Fire
L322.020Employee 11Storm
L322.020Employee 23Storm
L322.020Employee 34Storm
L322.021Employee 11Tornado
L322.021Employee 22Tornado
L322.021Employee 33Tornado
L322.021Employee 45Tornado
L322.021Employee 54Tornado
L322.022Employee 11Fire 
L322.022Employee 21Fire 
L322.022Employee 32Fire 
L322.022Employee 43Fire 
L322.022Employee 52Fire 
L322.023Employee 11Storm
L322.023Employee 22Storm
L322.023Employee 33Storm

 

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? 

Sean
Community Champion
Community Champion

@Js112233

Click the Matrix Visual button - drag Cause to the Rows - drag ID to the Values - click on ID and select Count (Distinct)

 

Matrix Visual.png

 

Thats it! Smiley Happy

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!!!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.