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
pankajgurbani
New Member

Matrix visualization: assigning (fixed) values in Total cell

Can we assign a value, which is not an aggregation of other values in the subsection of the matrix visualization. 

eg. in the below table, the yellow cells are not sum, average, or any other calculation from other values in the column, but a target value defined by business..

 

Capture.PNG

1 ACCEPTED SOLUTION
JarroVGIT
Resident Rockstar
Resident Rockstar

You could use a measure for the second column and use the ISINSCOPE() function to determine what value to use. For example, I created the following 2 tables in PBI (also: please never post pictures of tables because now we have to recreate it for you):

CountryPersonActual SalesTarget Sales
USAPerson1150150
USAPerson2160130
USAPerson3120140
CanadaPerson1200250
CanadaPerson2100200
CanadaPerson3150150
MexicoPerson1100120
MexicoPerson2100130
MexicoPerson3100140
    
CountryTarget Sales 
USA350  
Canada540  
Mexico360  

 

I then created the following measure, which looks at the current context and determines if it is evaluated in a Country context of Person context. If it is the first case, than it will lookup the corresponding sales target in the second table, otherwise it will sum the Sales[Target Sales] column:

 

TargetSalesMeasure = 
SWITCH( TRUE(), 
    ISINSCOPE(Sales[Person]), SUM(Sales[Target Sales]),
    LOOKUPVALUE(CountryTargets[Target Sales], CountryTargets[Country], SELECTEDVALUE(Sales[Country])))

 

This results in the following matrix:

image.png

Neat stuff huh? 🙂 Let me know if this answers your question!

 

Kind regards

Djerro123

-------------------------------

If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.

Keep those thumbs up coming! 🙂

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
JarroVGIT
Resident Rockstar
Resident Rockstar

You could use a measure for the second column and use the ISINSCOPE() function to determine what value to use. For example, I created the following 2 tables in PBI (also: please never post pictures of tables because now we have to recreate it for you):

CountryPersonActual SalesTarget Sales
USAPerson1150150
USAPerson2160130
USAPerson3120140
CanadaPerson1200250
CanadaPerson2100200
CanadaPerson3150150
MexicoPerson1100120
MexicoPerson2100130
MexicoPerson3100140
    
CountryTarget Sales 
USA350  
Canada540  
Mexico360  

 

I then created the following measure, which looks at the current context and determines if it is evaluated in a Country context of Person context. If it is the first case, than it will lookup the corresponding sales target in the second table, otherwise it will sum the Sales[Target Sales] column:

 

TargetSalesMeasure = 
SWITCH( TRUE(), 
    ISINSCOPE(Sales[Person]), SUM(Sales[Target Sales]),
    LOOKUPVALUE(CountryTargets[Target Sales], CountryTargets[Country], SELECTEDVALUE(Sales[Country])))

 

This results in the following matrix:

image.png

Neat stuff huh? 🙂 Let me know if this answers your question!

 

Kind regards

Djerro123

-------------------------------

If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.

Keep those thumbs up coming! 🙂

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.