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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
JoshP11
Helper II
Helper II

Conditional formatting for visual

Hello,

 

I'm struggling to add some conditional formatting to a visual.

 

I have a filter for Name, and then a filter for Date, this then dynamically changes another visual which displays Jump Height.

 

JoshP11_0-1727710603759.png

 

I then want the colour of the column to change based on the below.

 

CategoryHeight
Above Average> = Average + Standard Deviation
High AverageBetween Average + Standard Deviation & Average + 0.5 * Standard Deviation
Low AverageBetween Average + 0.5 * Standard Deviation & Average - 0.5 * Standard Deviation
Below Average< = Average - Standard Deviation

 

For example, depending on what 41.8 is equal to, the colour will change, for example if it's above average, then the column in the visual will show green.

 

Does anyone know a way of doing this? I do also have those calculations already calculated in a seperate table I have loaded in if thats helps.

 

Hopefully this makes sense and I would appreiate any help provided.

 

Thanks

1 ACCEPTED SOLUTION

Hi @JoshP11 ,

 

I made simple samples and you can check the results below:

vtianyichmsft_0-1727747862207.png

Average = AVERAGEX(ALL('Table'),[Jump Height])

Standard Deviation = CALCULATE(STDEV.P('Table'[Jump Height]),ALL('Table'))

Measure = var ave =[Average]
VAR sta = [Standard Deviation]
RETURN
SWITCH(
    TRUE(),
    MAX('Table'[Jump Height]) >= ave + sta, "Above Average",
    MAX('Table'[Jump Height]) >= ave + 0.5 * sta && MAX('Table'[Jump Height]) < ave + sta, "High Average",
    MAX('Table'[Jump Height]) >= ave - 0.5 * sta && MAX('Table'[Jump Height]) < ave + 0.5 * sta, "Low Average",
    MAX('Table'[Jump Height]) <= ave - sta, "Below Average",
    "Other"
)

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

6 REPLIES 6
parry2k
Super User
Super User

@JoshP11 it is a bit hard to explain, It will be easier if you share pbix file using one drive/google drive with the expected output. Remove any sensitive information before sharing.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@JoshP11 you can create a measure for the color and use that in the condition formatting using field value"

 

Color = 
//this is where you color logic will go
IF ( X > Y, "Red", "Green" )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi @parry2k 

 

Thank you for replying!

 

I'm pretty new at PBI, how would I write the logic?

 

Thanks,

Josh

HI @parry2k 

 

It's basically just this in the data so far whilst Ive been trying to work out how to do it.

 

NameDateJump Height
NAMEONE01/01/202440.3
NAMEONE01/04/202438.35
NAMEONE29/09/202440.05
NAMETWO02/04/202437.5
NAMETWO04/04/202439
NAMETWO04/12/202442.34
NAMETHREE01/01/202441.44
NAMETHREE20/01/202437.9
NAMETHREE27/01/202436.4
NAMETHREE15/02/202439.25
NAMETHREE22/04/202441.24
NAMEFOUR26/04/202441.5
NAMEFOUR11/05/202440
NAMEFIVE18/09/202439.45
NAMEFIVE21/09/202438.36
NAMEFIVE27/09/202438.7
NAMESIX02/03/202440.13
NAMESIX19/04/202442.22
NAMESEVEN22/04/202435.45
NAMEEIGHT09/09/202438.4
NAMEEIGHT28/09/202439.8
NAMEEIGHT29/09/202440.25
NAMENINE05/05/202444.45
NAMENINE08/09/202443.1

Hi @JoshP11 ,

 

I made simple samples and you can check the results below:

vtianyichmsft_0-1727747862207.png

Average = AVERAGEX(ALL('Table'),[Jump Height])

Standard Deviation = CALCULATE(STDEV.P('Table'[Jump Height]),ALL('Table'))

Measure = var ave =[Average]
VAR sta = [Standard Deviation]
RETURN
SWITCH(
    TRUE(),
    MAX('Table'[Jump Height]) >= ave + sta, "Above Average",
    MAX('Table'[Jump Height]) >= ave + 0.5 * sta && MAX('Table'[Jump Height]) < ave + sta, "High Average",
    MAX('Table'[Jump Height]) >= ave - 0.5 * sta && MAX('Table'[Jump Height]) < ave + 0.5 * sta, "Low Average",
    MAX('Table'[Jump Height]) <= ave - sta, "Below Average",
    "Other"
)

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

Thank you @v-tianyich-msft  - that worked perfectly!

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.