Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
PeterAlex
Regular Visitor

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:

PeterAlex_0-1646920511027.png

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:

PeterAlex_4-1646920742946.png

 

In the matrix I used the following conditional formatting:

PeterAlex_5-1646920760040.png

 

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):

PeterAlex_6-1646920939802.png

 

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

 

 

1 REPLY 1
v-chenwuz-msft
Community Support
Community Support

Hi @PeterAlex ,

 

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.

vchenwuzmsft_0-1647225995817.png

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.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.