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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Conditional formatting if measure is within measure

Hi there,

 

my ambition is to conditionally format a scattar chart. 

The size of the scattar/bubble chart is determined by the measure [Value]. 

Value = 
[Done Risk green] + [Done Risk yellow] + [Done Risk red] + [Done Risk unplanned]+ [Sheduled Risk green] + [Sheduled Risk yellow] + [Sheduled Risk red] + [Sheduled Risk unplanned]

 

As the picture bellow shows, measure [Value] is the sum of multiple [measures]. These [measures] have only one value per row and are all structured the same but search for different search variables (r/y/g).

Sheduled Risk red = 
IF(MAX('NPLM Import'[Risk status (color)]) = "r", 
    IFERROR([Ø Annual Turnover (EUR) Sheduled], 0))

2020-08-04_12-41-22.png

Therefore, my Measure for conditional formatting of [Value] shall check in each case whether the returned 'Value' is e.g. in the column 'Done Risk red'. If so, it should return a HEX code

 

Basically, it is this idea:

Value Colour = 
SWITCH(TRUE(),
    [Value] = [Done Risk green], "#D7E4BD",
    [Value] = [Done Risk yellow], "#FFE8A1",
    [Value] = [Done Risk red], "#FFA1A1",
    [Value] = [Done Risk unplanned], "#D0D0D0",
    [Value] = [Sheduled Risk green], "#92D050",
    [Value] = [Sheduled Risk yellow], "#FFFF26",
    [Value] = [Sheduled Risk red], "#FF3300",
    [Value] = [Sheduled Risk unplanned], "#A6A6A6")

 

But that's not working, neither is Lookupvalue returning the anticipated result

Value Colour2 = 
SWITCH(TRUE(),
    [Value] = LOOKUPVALUE('NPLM Import'[Yearly average turnover (EUR)], 'NPLM Import'[Yearly average turnover (EUR)], [Done Risk green]), "#D7E4BD", 
    [Value] = LOOKUPVALUE('NPLM Import'[Yearly average turnover (EUR)], 'NPLM Import'[Yearly average turnover (EUR)], [Done Risk yellow]), "#FFE8A1",
    [Value] = LOOKUPVALUE('NPLM Import'[Yearly average turnover (EUR)], 'NPLM Import'[Yearly average turnover (EUR)], [Done Risk red]), "#FFA1A1",
    [Value] = LOOKUPVALUE('NPLM Import'[Yearly average turnover (EUR)], 'NPLM Import'[Yearly average turnover (EUR)], [Done Risk unplanned]), "#D0D0D0",
    [Value] = LOOKUPVALUE('NPLM Import'[Yearly average turnover (EUR)], 'NPLM Import'[Yearly average turnover (EUR)], [Sheduled Risk green]), "#92D050",
    [Value] = LOOKUPVALUE('NPLM Import'[Yearly average turnover (EUR)], 'NPLM Import'[Yearly average turnover (EUR)], [Sheduled Risk yellow]), "#FFFF26",
    [Value] = LOOKUPVALUE('NPLM Import'[Yearly average turnover (EUR)], 'NPLM Import'[Yearly average turnover (EUR)], [Sheduled Risk red]), "#FF3300",
    [Value] = LOOKUPVALUE('NPLM Import'[Yearly average turnover (EUR)], 'NPLM Import'[Yearly average turnover (EUR)], [Sheduled Risk unplanned]), "#A6A6A6")

 

Is there a better way to do so?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Apparently, it does work with a minor addition:

Value Colour = 
SWITCH(TRUE(),
    ISBLANK([Value]), BLANK(),
    [Value] = [Done Risk green], "#acdc6f",
    [Value] = [Done Risk yellow], "#ffcc5d",
    [Value] = [Done Risk red], "#ff9594",
    [Value] = [Done Risk unplanned], "#D0D0D0",
    [Value] = [Sheduled Risk green], "#619822",
    [Value] = [Sheduled Risk yellow], "#ca8d00",
    [Value] = [Sheduled Risk red], "#ac1838",
    [Value] = [Sheduled Risk unplanned], "#A6A6A6")

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Apparently, it does work with a minor addition:

Value Colour = 
SWITCH(TRUE(),
    ISBLANK([Value]), BLANK(),
    [Value] = [Done Risk green], "#acdc6f",
    [Value] = [Done Risk yellow], "#ffcc5d",
    [Value] = [Done Risk red], "#ff9594",
    [Value] = [Done Risk unplanned], "#D0D0D0",
    [Value] = [Sheduled Risk green], "#619822",
    [Value] = [Sheduled Risk yellow], "#ca8d00",
    [Value] = [Sheduled Risk red], "#ac1838",
    [Value] = [Sheduled Risk unplanned], "#A6A6A6")

 

Pragati11
Super User
Super User

HI @Anonymous ,

 

What error are you getting in your measure "Value Colour"??

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors