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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Conditional formatting when comparing yesterdays date to a 6 week average

I have two score cards in the image below. The top one is Unique Visitors showing yesterdays data while the bottom one is the daily average of the last 6 weeks. 

 

What approach can I take if I want the top scorecard to either be green if it is higher than the 6 week daily average or red if it is lower than the 6 week average?

 

image.png

The image below is the filter I use for the 6 week daily average metric. I have a separate 'date' table that has a 'period' field that allows me to select yesterday, 2 weeks ago, 6 weeks ago, etc. 

 
 

image.png

I'm using the following tables, just for reference:

Site Totals Table:

- Metric: Unique Visitors -> used on the top scorecard and that scorecard has a filter on it to only look at yesterdays data.

- Calculated metric for the  6 week daily average scorecard: Avg Daily UVs = AVERAGEX( VALUES(Date_and_Periods[Date]), ('Site Totals'[Total UVs]))

 

Appreciate any help!

 

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I create three simple measures to test.

Top card value = 1200
Avg Daily UVs = 1300
Visual control = 
IF(
    [Top card value]>[Avg Daily UVs],
    "green",
    "red"
)

 

Then you may make the top value card selected, go to 'Visualization' ribbon, click 'Format'=>'Background'=>'Conditional formatting', set as below.

e1.png

e2.png

 

Result:

e3.png

 

You may also try the Card with States Custom Visual from the marketplace.

 

Best Regards

Allan

 

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

View solution in original post

1 REPLY 1
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I create three simple measures to test.

Top card value = 1200
Avg Daily UVs = 1300
Visual control = 
IF(
    [Top card value]>[Avg Daily UVs],
    "green",
    "red"
)

 

Then you may make the top value card selected, go to 'Visualization' ribbon, click 'Format'=>'Background'=>'Conditional formatting', set as below.

e1.png

e2.png

 

Result:

e3.png

 

You may also try the Card with States Custom Visual from the marketplace.

 

Best Regards

Allan

 

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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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