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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
byr10112
Microsoft Employee
Microsoft Employee

Sum distinct based on the values of two columns

I have a table that shows annual sales and quota for each account. Each account also has a number of sales opportunities linked to them. I am trying to include all the information in one table, so I merged two queries into one. The problem is now the sales and quota numbers are being double, sometimes triple counted. Below is an example of what my data looks like:

Account IDSegmentSalesQuotaOpportunity IDOpportunity $
1001X110080XYZ200
1001X215090XYZ200
1001X110080XXX210
1001X215090XXX210
1001X110080CRD150
1001X215090CRD150

 

I'm trying to create a measure that will only sum the sales (and another one for quota) based on Account ID and Segment. So ideally, in the background it should look like this:

Account IDSegmentSalesQuota
1001X110080
1001X215090
Total 250170

 

How can I create a measure to only display the unique sales for accountID and Segment?

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

One of ways to solve this is to summarize the table to show distinct information.

 

Picture1.png

 

Sales measure: = 
SUMX ( SUMMARIZE ( Data, Data[Sales] ), Data[Sales] )

 

Sales measure: =
SUMX ( SUMMARIZE ( Data, Data[Sales] ), Data[Sales] )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

1 REPLY 1
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

One of ways to solve this is to summarize the table to show distinct information.

 

Picture1.png

 

Sales measure: = 
SUMX ( SUMMARIZE ( Data, Data[Sales] ), Data[Sales] )

 

Sales measure: =
SUMX ( SUMMARIZE ( Data, Data[Sales] ), Data[Sales] )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.