Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

DAX formula for Matrix visual

Example to undersatnd the data:- 60 is the total Model Allocated capacity of Models 855 and N14 both under S/N 1. Similarly 72 is Model Allocated capacity of Models QSM15 under S/N 2.  Question:-...
  • 123abc's avatar
    2 years ago

    First, create a calculated measure that will evaluate if the demand exceeds the allocated capacity or not. Use the following logic in the DAX formula:

     

    DemandVsCapacity =
    IF(
    SUM(SalesTable[Total Demand]) > SUM(SalesTable[Model Allocated Capacity]),
    1,
    0
    )

     

    • eplace SalesTable with the name of your table, and Total Demand and Model Allocated Capacity with the corresponding column names.

    Conditional Formatting in Matrix Visual:

    1. After creating the DAX measure DemandVsCapacity, add it to your Matrix visual.

    2. Go to the Values area of the Matrix visual, click the dropdown next to the new measure DemandVsCapacity, and select Conditional Formatting > Background Color.

    3. In the conditional formatting settings, choose Field Value and select the measure DemandVsCapacity.

    4. Define the colors for the output:

      • For 0 (Demand less than Capacity): Choose Red.
      • For 1 (Demand greater than Capacity): Choose Green.

    Now, based on the comparison of demand and capacity, your Matrix visual will show cells with red or green backgrounds.

     

    If you have still issue with this problem pleaes feel free and contact with me.