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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Anonymous
Not applicable

Conditional Formatting based on weekly data

Hello

I want to asked how to do conditional formatting on weekly data.

I want the background would be red if any week is less than previous week and the background would be green if its greater. 

I already have date table in here.

 

The example data look like this :

ChristoNindyo_0-1701086626125.png

 

Thank you 

1 ACCEPTED SOLUTION
joaoribeiro
Impactful Individual
Impactful Individual

Hi @Anonymous ,

 

You can use a custom measure to calculate the differences between weeks and assign a color code to each result, and then use this measure in the conditional formatting using the option 'Field Value' (please refer to image below).

joaoribeiro_0-1701087643198.png


An example of a custom measure for color coding:

Color Coding = 

SWITCH(
    TRUE(),
    [This Week] < [Last Week], "#DC143C" // Red
    [This Week] > [Last Week], "#85cc18" // Green
    [This Week] = [Last Week], "#0c0c0c" // Black
)

 

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍

Thanks!

Best regards,
Joao Ribeiro

View solution in original post

3 REPLIES 3
joaoribeiro
Impactful Individual
Impactful Individual

Hi @Anonymous ,

 

You can use a custom measure to calculate the differences between weeks and assign a color code to each result, and then use this measure in the conditional formatting using the option 'Field Value' (please refer to image below).

joaoribeiro_0-1701087643198.png


An example of a custom measure for color coding:

Color Coding = 

SWITCH(
    TRUE(),
    [This Week] < [Last Week], "#DC143C" // Red
    [This Week] > [Last Week], "#85cc18" // Green
    [This Week] = [Last Week], "#0c0c0c" // Black
)

 

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍

Thanks!

Best regards,
Joao Ribeiro

Anonymous
Not applicable

@joaoribeiro what should I put in DAX for [This Week] and [Last Week] ?

@Anonymous it was just an example of measures with the current and last week values for the metric you are trying to compare. Please let me know if you need help with this part too.

 

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍

Thanks!

Best regards,
Joao Ribeiro

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors