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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply

Conditional Formatting Matrix Issue

I need conditional formatting on the below matrix by week number. 

I have set up as gradiant from red to white to green. 

The problem is that it clearly is looking at the sums by location based on all of the data rather than looking at it by week number since there is no green in most weeks.

The week number is located in a date table and the date table is marked as such. I posted what my date table looks like in case it matters.

How would I go about fixing this? I am still very new to PowerBI.

 

Screenshot 2024-06-24 130418.png

 

 

ThisIsHalloween_0-1719250359274.png

 

1 ACCEPTED SOLUTION

Hi

You can use a if or swtich to achieve this, Below measue should work. Notice that i have changed the whole base measure for more efficiency. 

Rankweek =
Var Rk = RANK (
    DENSE,
    ALLEXCEPT ( 'Rank', 'Rank'[Location] ),
    ORDERBY ( [Sales#], DESC BLANKS LAST )
)
return if(or([Sales#]=0,[Sales#]=BLANK()),BLANK(),Rk)
  NaveenGandhi_3-1719332205460.png

 


 If this post helps, then please consider Accept it as the solution to help the others find it more quickly. Appreciate you kudos!!
 

View solution in original post

5 REPLIES 5

I gave that a try and things improved but I need to also have it ignore the locations that did not collect anything (so all the 0s or blanks). How would I go about that?

NaveenGandhi
Super User
Super User

Hi 

Create a column by concatenating your week and location as below.

NaveenGandhi_6-1719252687217.png

 



Then based of this sales and this column create a measure to rank your weekly sales.

RankWeekSales =
RANKX(
    ALLEXCEPT('Table', 'Table'[Location], 'Table'[Locationweek]),
    CALCULATE(SUM('Table'[Sales])),
    ,
    DESC,
    Skip
)
Conditional format based on the above measure and you get below result.
NaveenGandhi_5-1719252668988.png

 


 
NaveenGandhi_4-1719252654071.png

 

 

 Is it what you are looking for, Let me know if you still need some help.

If this post helps, then please consider Accept it as the solution to help the others find it more quickly. Appreciate you kudos!!

I gave that a try and things improved but I need to also have it ignore the locations that did not collect anything (so all the 0s or blanks). How would I go about that?

Hi

You can use a if or swtich to achieve this, Below measue should work. Notice that i have changed the whole base measure for more efficiency. 

Rankweek =
Var Rk = RANK (
    DENSE,
    ALLEXCEPT ( 'Rank', 'Rank'[Location] ),
    ORDERBY ( [Sales#], DESC BLANKS LAST )
)
return if(or([Sales#]=0,[Sales#]=BLANK()),BLANK(),Rk)
  NaveenGandhi_3-1719332205460.png

 


 If this post helps, then please consider Accept it as the solution to help the others find it more quickly. Appreciate you kudos!!
 

Thank you!!!! I appreciate your help so much!!!

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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