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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
alienout
Frequent Visitor

How to sum data in column A , where ID is distinct and for specific value in column B

IDColumn A Column B
110Document
110Document
212Solution
212Solution
212Solution
320Document
320Document
320Document


My table has duplicates. 

how do I sum values in column A, for a "Document" in column B ?
So, the formula returns 30. 

also, looking to count distinct ID's for "document".  Formula returns 2. 

 

2 ACCEPTED SOLUTIONS
Ritaf1983
Super User
Super User

Hi @alienout 
For sum please use a measure :

Sum unique =
CALCULATE(
SUMX(
SUMMARIZE('Table','Table'[ID],"max",MAX('Table'[Column A ])),[max]),FILTER('Table','Table'[Column B]="Document"))
Ritaf1983_0-1710990231230.png

For count:

Count unique =
CALCULATE(
COUNTX(
SUMMARIZE('Table','Table'[ID],"max",MAX('Table'[Column A ])),[max]),FILTER('Table','Table'[Column B]="Document"))
Ritaf1983_1-1710990292960.png

Pbix is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1710992383473.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
alienout
Frequent Visitor

Thank you 

@Ashish_Mathur @Ritaf1983 

both solutions are working out for me. 

 

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1710992383473.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ritaf1983
Super User
Super User

Hi @alienout 
For sum please use a measure :

Sum unique =
CALCULATE(
SUMX(
SUMMARIZE('Table','Table'[ID],"max",MAX('Table'[Column A ])),[max]),FILTER('Table','Table'[Column B]="Document"))
Ritaf1983_0-1710990231230.png

For count:

Count unique =
CALCULATE(
COUNTX(
SUMMARIZE('Table','Table'[ID],"max",MAX('Table'[Column A ])),[max]),FILTER('Table','Table'[Column B]="Document"))
Ritaf1983_1-1710990292960.png

Pbix is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.