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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
QQQ
Advocate II
Advocate II

Use DISTINCT as filter when calculating SUM

Here is a table

 

Incident_IDTriggersStatus
754571441Red
754571441Green
754588316Purple
754980015Red
754980015Green
754980015Orange

 

Given, there will alway be same number of triggers for a particular ID. But I don't want to count those triggers multiple times.

 

I tried the following DAX. My expected answer is 72, but I get 143 instead. How to fix?

 

Distinct_Matches:=CALCULATE(sum(Incidents[Triggers]),DISTINCT(Incidents[Incident_ID]))

 

1 ACCEPTED SOLUTION
marcorusso
Most Valuable Professional
Most Valuable Professional

If you are sure that Triggers and Incident_ID have a 1:1 relatioship, you could use this:

 

Distinct_Matches :=
SUMX (
    SUMMARIZE ( Incidents, Incidents[Incident_ID], Incidents[Triggers] ),
    Incidents[Triggers]
)

View solution in original post

2 REPLIES 2
marcorusso
Most Valuable Professional
Most Valuable Professional

If you are sure that Triggers and Incident_ID have a 1:1 relatioship, you could use this:

 

Distinct_Matches :=
SUMX (
    SUMMARIZE ( Incidents, Incidents[Incident_ID], Incidents[Triggers] ),
    Incidents[Triggers]
)

@marcorusso Thanks for the quick response!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.