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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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