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
westerdaled
Frequent Visitor

How to apply a calculation to sum of value in a Matrix control based on the grouping category

 

As part of a dashboard design , I have imported 2 Excel tables into Power BI desktop from the same worksheet

 

I have replicated the pivot tables for each Excel table using a Matrix visual. Each Matrix conists of 3 colums, Category, Accounting Period of Sum of Value. Expanding the Category, I can see for each quarter, the relevant sum value.  Now the hard bit, If I want use the Category to apply a weighting to each sum, then this seems imposible say trying to with a Measure:  I cannot use say the SWITCH command on the Category, as it won't understand the context, in the model. Is there anyway around this.

 

 

 

 

 

 

3 REPLIES 3
Greg_Deckler
Super User
Super User

@westerdaled Hard to be sure without sample data to mock up but you should be able to apply the Category as a weight by just using MAX('Table'[Category]) and applying the appropriate weight. See if this gives you some ideas.

Matrix Measure Total Triple Threat Rock & Roll - Microsoft Power BI Community

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

 

Thanks for getting back to me . Unfortunately, I don't have access to the this Report; I am assisting the staff who do. That said, I should be able to mock up the Excel Table used in the transformation import.

 

I can clarify what format cagegory is in: essentially, it is "AA-BB-CC" or "AAAA-BB-CC" . The calculation applied to the Sum of Value is determi ed by the first set of characters before the delimiter. I think the MAX('Table'[Category]) only works with a numeric value.  

@Greg_Deckler 

 

I have been looking through your code sample and I think you do have an interesting approach as regards the weighting, which I will try:

 

 

 

IF( MAX(Table[Category)="AA-BB-CC", [SumOfTotal) * x, If(( MAX(Table[Category])="AA-BB-DD"[SumOfTotal) * x)))

 

 

 

I am still trying to get my head around Max() with alphanumeric argument😕

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.