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
jcastr02
Post Prodigy
Post Prodigy

Summing with distinct values

how can i get a sum of all values of three columns (minor, major, critical) but only distinct values based on the ID column.  My data has repeating rows and I can't remove because I'm using other fields value.   (ex. since ID 14 is repeating, we would only count that once)

 

IDMinor TotalMajor TotalCritical Total
12210
10021
111110
13333
14401
14401
15500
14401
14401

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@jcastr02 , Create measure like this for all three columns

 

sumx(summarize(Table,Table[ID], Table[Minor Total]),[Minor Total])

 

sumx(summarize(Table,Table[ID], Table[Major Total]),[Major Total])

 

sumx(summarize(Table,Table[ID], Table[Critical Total]),[Critical Total])

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
Community Support

@jcastr02 

Try Amit's codes and add up all of them into a measure like below, this should work.

Measure = sumx(summarize('Table','Table'[ID], 'Table'[Minor Total]),[Minor Total]) + sumx(summarize('Table','Table'[ID], 'Table'[Major Total]),[Major Total]) + sumx(summarize('Table','Table'[ID], 'Table'[Critical Total]),[Critical Total])

You can also try this measure:

Measure 2 = SUMX(SUMMARIZE('Table','Table'[ID],'Table'[Minor Total],'Table'[Major Total],'Table'[Critical Total]),'Table'[Minor Total]+'Table'[Major Total]+'Table'[Critical Total])

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

mhossain
Solution Sage
Solution Sage

@jcastr02 

 

In adition to @amitchandak  's dax, you can also try below measure:

DistinctCount based on 3 cols =
CALCULATE(DISTINCTCOUNT('Table'[ID]) , 'Table'[Minor Total]>0)
+
CALCULATE(DISTINCTCOUNT('Table'[ID]) , 'Table'[Major Total]>0)
+
CALCULATE(DISTINCTCOUNT('Table'[ID]) , 'Table'[Critical Total]>0)
amitchandak
Super User
Super User

@jcastr02 , Create measure like this for all three columns

 

sumx(summarize(Table,Table[ID], Table[Minor Total]),[Minor Total])

 

sumx(summarize(Table,Table[ID], Table[Major Total]),[Major Total])

 

sumx(summarize(Table,Table[ID], Table[Critical Total]),[Critical Total])

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.