Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to use conditional formatting on a Score card - comparing it to an average

I'm hoping someone can help me out with this. 

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?

 

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. 

 

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!

 

  • Anonymous's avatar
    Anonymous
    6 years ago

    Anonymous 

    Power BI default Card visual do not support compare columns or measures with conditional formmat. 


    For you requirement, I would suggest you to try the Card with States Custom Visual. But you would need to create a measure or column and include the filter in the dax rather just use filter panel. I am not sure about your table, it can be something like: 

     

    New Unique visitors = Calculate(sum[Unique Visitors]),filter(table, [Period]="22|Last 6 Weeks")

     

    Then compare the 2 measure with Car with States visual. 

    Remember, It automatically compares with large than">", so you will need to swap the 2 measures when you what small than">".

     

    Paul Zheng _ Community Support Team
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
     

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Anonymous 

    Power BI default Card visual do not support compare columns or measures with conditional formmat. 


    For you requirement, I would suggest you to try the Card with States Custom Visual. But you would need to create a measure or column and include the filter in the dax rather just use filter panel. I am not sure about your table, it can be something like: 

     

    New Unique visitors = Calculate(sum[Unique Visitors]),filter(table, [Period]="22|Last 6 Weeks")

     

    Then compare the 2 measure with Car with States visual. 

    Remember, It automatically compares with large than">", so you will need to swap the 2 measures when you what small than">".

     

    Paul Zheng _ Community Support Team
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.