Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Different conditional formatting rules for different categories in Matrix

Good day,

 

 I have the problem for which I cannot find solution, maybe you would be able to support me. I have a data source weekly_movements_data with data from every week and based on Report Date I added Start of Week in Power Query:

Based on this data I counted difference in number of invoices between two last weeks using Below DAX measure:

 

Comparison of documents = (CALCULATE(DISTINCTCOUNT(weekly_movements_data[Invoice ID]), FILTER(weekly_movements_data, weekly_movements_data[Report Date - Start of Week] = MAX(weekly_movements_data[Report Date - Start of Week])))) - (CALCULATE(DISTINCTCOUNT(weekly_movements_data[Invoice ID]), FILTER(weekly_movements_data, weekly_movements_data[Report Date - Start of Week] = (MAX(weekly_movements_data[Report Date - Start of Week]) - 7))))

 

I used my DAX measure and Invoice Status to create matrix below:

 

In the matrix I used the following conditional formatting:

 

So:

  • When value is above 0 the cell is red marked,
  • When value equals 0 the cell is amber marked,
  • When value is below 0 the cell is green marked.

Unfortunately this is correct logic only for two from three Invoice Statuses: for After due date and for Delivered. For status Done I would like to have reverse logic of conditional formatting – above 0 is green, below 0 is red and 0 is amber (like in the matrix below):

 

Do you come up with any solution? Is it possible to get that result somehow? Thank you all for support!

 

 

1 Reply

  • v-chenwuz-msft's avatar
    v-chenwuz-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    It hard to figurt out why it is wrong without some example data. 

    Can you try this following measure which result is color to conditional formatting.

    formatting =
    SWITCH (
        TRUE (),
        [Comparison of documents] < 0, "green",
        [Comparison of documents] = 0, "yellow",
        "red"
    )
    

     

    Best Regards

    Community Support Team _ chenwu zhu

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.