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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
WinterMist
Impactful Individual
Impactful Individual

Return Different Measures Based On Matrix Row Values

Hello -

 

I have the following Matrix visual:

 

Rows:

- 'D SalesRep'[Name]

- 'D Customer'[Name]

- 'D SalesType'[Name]

- 'D Product'[Group Code Description]

- 'D Product'[Code]

 

Values (currently include 3 measures):

- [Sales Amount] = SUM('F Sales'[Sales])

- [M Contract] = [Sales Amount] * 2
- [M Direct] =

   IF(
       NOT(ISBLANK([Sales Amount])),
       ([Sales Amount] / 2) + 3
   )

 

NOTE: The measures for [M Contract] & [M Direct] are arbitrary.  In this case they are dummy measures, but in reality could hold any calculation.

 

WinterMist_0-1688128221364.png

 

The goal in the matrix visual is to replace [M Contract] & [M Direct] with a new measure called [Sales Based on Type], which calls these different measures based on the matrix row values.

 

Something like the following:

IF('D SalesType'[Name] = "Contract", [M Contract],
IF('D SalesType'[Name] = "Direct", [M Direct]))

 

Additionally, IF the granularity in the matrix is HIGHER than 'D SalesType'[Name] (e.g. SalesRep or Customer), THEN the totals rows should correctly calculate the sums of the different measures from the lower granularity of 'D SalesType'[Name].

 

Regards,

Nathan

4 REPLIES 4
WinterMist
Impactful Individual
Impactful Individual

@tamerj1 

 

Good catch.  So this is the entire 'F Sales' table, and there are no common products sold by both Sales Reps.

 

WinterMist_0-1688134145968.png

 

I did notice that the Total for [M Contract] is the sum of row values,

whereas the Total for [M Direct] is NOT the sum of row values.

 

WinterMist_1-1688134396179.png

 

 

Not sure, but I'm guessing this is because [M Contract] is additive & [M Direct] is non-additive.

 

Something like what Ferrari describes here: https://www.youtube.com/watch?v=6rgAkejrup8

 

Ferrari mentions that averages are non additive measures.

So I'm wondering if because there is a division operator in [M Direct], it causes it to be non-additive?

 

Regards,

Nathan

@WinterMist 
You are right. [M Direct] is non-additive. But I guess it makes sense to force additivity. 

WinterMist
Impactful Individual
Impactful Individual

It just hit me.  I think the SUMX iterator over 'D SalesType' does it.

 

WinterMist_0-1688130533438.png

 

 

If anyone has a different suggestion, let me know.

 

Regards,

Nathan

@WinterMist 
Good job!

For some reason the total shows 189 instead of 192. Seems there are common products sold by both salesReps. I guess they still need to be counted twice?

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.