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

Ratio including a sum with a subtotal

Hi,

 

I have difficulties to calculate ratio including a sum with a subtotal

Based on the example below (table "customer") I need to create a matrix table with Path and x/y as rows and calulated results in columns

 

         

Path       x/yStep     Nb CusInc        Color
Ax1 34Blue
Ay1 91Black
Bx2 83Red
By2 61Green
Cx2 75White
Cy2 71Purple
Dx2 99Black
Dy2 84Red
Ax166 Blue
Ay132 Black
Bx212 Red
By222 Green
Cx279 White
Cy297 Purple
Dx233 Black
Dy226 Red

 

First and seconds columns are the sum for number of customer and income. No problem here

 

For the other calculations, I need to divide the total (sum Inc) by the sum NbCus when step = 1. For now I only have results where path equals A but I need to use the results (66+32) for other Path as well

I will also need to be able to filters(by color and other variables available)  in my report and this matrix

I think I need to use the allexcept function but have difficulties to understand how. Any suggestion ?

 

 

3 REPLIES 3
Anonymous
Not applicable

 Thanks for the answer but this solution does not select the sum(Nb cus) where step = 1 and apply this results as divider for any Path, x/y and step combination. The provided answer only works for the first 2 rows but not after. For example for the third row, I need to be able to create the formula 83/(66+32). Did I miss something?

Anonymous
Not applicable

Works fine with 2 measures:

ZZM_SumNBCust = CALCULATE(SUM(data[Nb Cus]), ALL(data), data[Step] = 1")
 
ZZM_SumIncDivided = SUM(data[Inc]) / [ZZM_SumNBCust]
 
 
My problem now is that those results will not be able to be modified if I select values from different slicers. Any idea how to take slicers results into account with those calculation ?
v-chuncz-msft
Community Support
Community Support

@Anonymous ,

 

Just try to add a measure.

Measure =
DIVIDE ( SUM ( Table1[Inc] ), SUM ( Table1[Nb Cus] ) )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.