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
Gjakova
Post Patron
Post Patron

SUM of Price etc. based on distinct ID's

Hi there, I have been looking around the community for almost 2 hours but I can't seem to find a solution to my problem. Thought I got it, but the end result didn't match the expected value.

 

I have the following problem:

Gjakova_0-1615844018200.png

I want to calculate the price per Service ID. So let's say I want to calculate the revenue
Price * Amount = Revenue

My expected result:

Service IDRevenue
11.000
250
35.100
4585.000

 

Instead I get:

Service IDRevenue
116.000
2200
381.600
4585.000

 

Does someone know how to take only a unique service ID in my measure?

Thanks in advance!

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

This measure works

Measure = SUMX(SUMMARIZE(GENERATE(VALUES(Data[Price]),VALUES(Data[Amount])),Data[Price],Data[Amount],"ABCD",min(Data[Price]),"EFGH",MIN(Data[Amount])),[ABCD]*[EFGH])

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

v-shex-msft
Community Support
Community Support

HI @Gjakova,

It seems like your table exists lots of duplicate records, have you consider removing them before calculate them?
You can refer to Ashish_Mathur 's suggestion to summarize in expression or enter to 'query editor' to use the 'remove duplicate' feature.

Remove duplicates (Power Query) - Excel (microsoft.com)

18.png

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

HI @Gjakova,

It seems like your table exists lots of duplicate records, have you consider removing them before calculate them?
You can refer to Ashish_Mathur 's suggestion to summarize in expression or enter to 'query editor' to use the 'remove duplicate' feature.

Remove duplicates (Power Query) - Excel (microsoft.com)

18.png

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Ashish_Mathur
Super User
Super User

Hi,

This measure works

Measure = SUMX(SUMMARIZE(GENERATE(VALUES(Data[Price]),VALUES(Data[Amount])),Data[Price],Data[Amount],"ABCD",min(Data[Price]),"EFGH",MIN(Data[Amount])),[ABCD]*[EFGH])

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.