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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
elliegri
Regular Visitor

Colour Conditional Formating

Hi all,
I am new to Power BI and I am trying to create a graph that drills down from month to days to PCN to Practice - (I am working in healthcare). I have done this however I need to match the Practice and PCN to their individual colours.
 
I have managed to set up data sheet and a Measure which pulls these however when there is more than one practice in the PCN, it does not return the correct PCN colour. Therefore I need to set up a Measure which explain that if more than one practice is returned, choose the colour of the practice.
 
So far I have this:
 
Data Color Admin =
lookupvalue(
    'PCN & Practice colour'[Colour],
    'PCN & Practice colour'[Practice],
    SELECTEDVALUE('BP Admin Calls'[Registered practice]),
    "#374A92")
 
If you can help, this will save me more hours of research!
Thank you
1 ACCEPTED SOLUTION
vicky_
Super User
Super User

@elliegri 

this is what i meant by formatting the values based on heirarchy with HASONEVALUE() - except, just replace Orange with the rules you need for when there's more than 1 practice.

vicky__0-1700775705635.png

 

View solution in original post

3 REPLIES 3
vicky_
Super User
Super User

@elliegri 

this is what i meant by formatting the values based on heirarchy with HASONEVALUE() - except, just replace Orange with the rules you need for when there's more than 1 practice.

vicky__0-1700775705635.png

 

Great - thanks so much

vicky_
Super User
Super User

As you've noticed, the issue arises when there's more than 1 practice - and this is because the SELECTEDVALUE() function returns a blank in that case, so the lookup fails. One way around this is by wrapping your lookup in HASONEVALUE() - i.e:

Data Colour Admin = IF(HASONEVALUE(Table[Practice]), 
    // simply look up the colour..., 
    // else, your fallback logic here
)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.