Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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 calcula...
  • JarroVGIT's avatar
    6 years ago

    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:

    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! 🙂