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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. 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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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