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
Anonymous
Not applicable

Creating measure using several aggregating values

Hello everyone, 

 

I'ms struggling in building 3 different measure in Dax Syntax. In fact, I would like to calculate a measure based on the volume into a row divide by the sum of volume of several rows. Here is my usecase :

 

I have a table of country, brand, volumes and price such as below :

Table.PNG

I would like to calculate 3 differents measures. 

The first one is the proportion (in volume) of each brand into a specific country. 

The second one is the difference of price (at a row level) with the average price at a country level.

The third one is the profit by row divided by the total volume of the country. 

Here is the expected table in output : 

Table2.PNG

 

Can someone help me about this stuff ? 

 

Thank you in advance !  

1 ACCEPTED SOLUTION
Anonymous
Not applicable

First := DIVIDE(SUM(Test[Volume]),CALCULATE(SUM(Test[Volume]),ALLEXCEPT(Test,Test[Country])),0)

Second = SUM(Test[Price])-CALCULATE(AVERAGE(Test[Price]),ALLEXCEPT(Test,Test[Country]))
Third = DIVIDE(SUMX(Test,Test[Volume]*Test[Price]),CALCULATE(SUM(Test[Volume]),ALLEXCEPT(Test,Test[Country])),0)

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

First := DIVIDE(SUM(Test[Volume]),CALCULATE(SUM(Test[Volume]),ALLEXCEPT(Test,Test[Country])),0)

Second = SUM(Test[Price])-CALCULATE(AVERAGE(Test[Price]),ALLEXCEPT(Test,Test[Country]))
Third = DIVIDE(SUMX(Test,Test[Volume]*Test[Price]),CALCULATE(SUM(Test[Volume]),ALLEXCEPT(Test,Test[Country])),0)

 

Anonymous
Not applicable

Thank you very much @Anonymous, I will test the measure and let you know about the results. 

 

Anonymous
Not applicable

It works perfectly !!! Thank you very much @Anonymous to make it so easy ! 

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.

Top Solution Authors