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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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