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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Applicable88
Impactful Individual
Impactful Individual

use Values() to get disctinct sum

Hello,

 

I only want to sum an amount from a distinct orderID, but it always sums up both rows. 

My sample table looks like this:

OrderIDAmount
12342
12342

I'm using values to get a distinct row, wrapped in a sumx function:

Measure 16 =
SUMX(VALUES(Table[OrderID]), calculate(sum(Table[Amount)))
or
sumx(Distinct(Table[OrderID]), calculate(sum(Table[Amount)))
Whatever I do I get 4 insead of 2. 
But if I would calculate a new table derived from that uderlying table using values() one row would correctly vanish. 
 
What is wrong with that function?
Thank you very much in advance.
Best. 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Applicable88 , Try one of the three

 

Measure 16 =
SUMX(VALUES(Table[OrderID]), calculate(max(Table[Amount)))
or
sumx(Distinct(Table[OrderID]), calculate(average(Table[Amount)))
or
SUMX(summarize(Table[OrderID],Table[Amount), [Amount])

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Applicable88 , Try one of the three

 

Measure 16 =
SUMX(VALUES(Table[OrderID]), calculate(max(Table[Amount)))
or
sumx(Distinct(Table[OrderID]), calculate(average(Table[Amount)))
or
SUMX(summarize(Table[OrderID],Table[Amount), [Amount])

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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