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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
PaulMac
Helper IV
Helper IV

Sum Amount Only Where Customer Number Is Distinct

Hi

Here is my sample data:

Customer Number

Amount
AA110
AA225
AA225
AA225
AA225
AA3100
AA110
AA110
AA110
AA110
AA110
AA110
AA110
AA110
AA110

 

The Amount column is a repetative number and only value is needed but the dataset is provided as above.

 

What I am trying to accomplish:

I want to be able to produce a total amount that the customer has but only where the Customer Number is distinct. So if a Customer Number appears more than once I want to only include one amount value and disregard the remaining ones.

 

With regards to the table above, the correct amount total should be 135 but every DAX measure i try to produce will only ever show a total of 300.

 

Here is the code I thought would be sufficient but it is not working as I expected.

 

Distinct.Sum = CALCULATE( SUM( Table1[Amount] ) , DISTINCT( Table1[Customer Number] ))

 

As always, any assistance is greatly appreciated.
Paul

1 ACCEPTED SOLUTION
Barthel
Solution Sage
Solution Sage

Hey, 

Give this a try:

 

Distinct.Sum =
SUMX (
    KEEPFILTERS ( VALUES ( Table1[Customer Number] ) ),
    CALCULATE ( SELECTEDVALUE ( Table1[Amount] ) )
)

 

It might also be an idea to remove the duplicate values ​​in Power Query, if you don't use them in your report yet. Then you can just take the SUM.

 

 

View solution in original post

1 REPLY 1
Barthel
Solution Sage
Solution Sage

Hey, 

Give this a try:

 

Distinct.Sum =
SUMX (
    KEEPFILTERS ( VALUES ( Table1[Customer Number] ) ),
    CALCULATE ( SELECTEDVALUE ( Table1[Amount] ) )
)

 

It might also be an idea to remove the duplicate values ​​in Power Query, if you don't use them in your report yet. Then you can just take the SUM.

 

 

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.

Top Solution Authors