cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mjmjn2611
Frequent Visitor

Highlight below or above the average price

Hi, 

 

I want to create a measure to highlight below or above the average price.

 

For example 

 

Customer       Price      Check

A                    5            below average ==> red

B                     7           above average ==> green

C                     6

1 REPLY 1
selimovd
Community Champion
Community Champion

Hey @mjmjn2611 ,

 

you can add the color as a calculated column:

Check = 
VAR vRowPrice = myTable[Price] 
VAR vAveragePrice = AVERAGE(myTable[Price])
RETURN
SWITCH(
    TRUE(),
    vRowPrice < vAveragePrice, "red", 
    vRowPrice > vAveragePrice, "green"
)

 

Then you can use that column for the conditional formatting:

selimovd_0-1622549950485.png

 

And that's then the result you get:

selimovd_1-1622549982608.png

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

 

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

Get Ready for Power BI Dev Camp

Power BI Dev Camp - September 30th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.