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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Barculez
Regular Visitor

Fixed colour of columns

Hello, 

 

a would like to ask for help with colour of columns. I have weekly report, where are graphs of last 4 weeks, there are always same colours. Actual week is yellow, second one is grey, third is orange and last one is blue → the weeks are changing every week, but I need the colours always be the same based of week age.

 

Thank you for your help

Barbora 

3 REPLIES 3
MFelix
Super User
Super User

Hi @Barculez ,

 

For this you need to make a measure to force the colour of your weeks something similar to this:

Colour Coding =
SWITCH (
    TRUE (),
    MAX ( 'Date'[Week] ) = WEEKNUM ( TODAY () ), "Yellow",
    MAX ( 'Date'[Week] )
        = WEEKNUM ( TODAY () ) - 1, "Grey",
    MAX ( 'Date'[Week] )
        = WEEKNUM ( TODAY () ) - 2, "Orange",
    MAX ( 'Date'[Week] )
        = WEEKNUM ( TODAY () ) - 3, "Blue"
)

Not sure if you want to have the current date for the current week or the last week selected on a calendar but should work when you added it to condittionl formattting.

MFelix_0-1690359789555.png

 

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



I don´t have there a date, I've there just numbers of week which I filter. 

 

The chart looks like this:

Barculez_0-1690360548281.png

 

and every week, when I filter those last weeks i have to change the colour here:

Barculez_1-1690360641151.png

 

Do you think that the measure will work for this too? Or there is another way.

 

Thank you very much 

 

 

Hi @Barculez ,

 

The Date is the name of the table were my week is so in your case you must replace the Date[Week] by the name of the table you have for example FactTable[Week] but be aware that since you are using the week as legend you cannot use the condittional formatting.

 

Do you always want to get the last 4 weeks for this chart? how is this being built?


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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 FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors