cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Doors1980
Helper I
Helper I

Change fill colour of label based on other labels text value

Hi All,

 

Totally new to this so figuring things out as I go... Smiley Tongue

 

I have a text label called "Priority" that's populated with "High", "Medium" or "Low" text from a SharePoint list. (Not a dropdown, just a single line of text column)

 

Dependant on this value I'd like to change another labels fill to either red, orange or green.

 

This is not working:

 

If( text(Priority.Text) = "Low" , Color.Green, text(Priority.Text) = "Medium", Color.Orange, Color.Red )

 

Cheers in advance.  

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Hi @Doors1980

 

I assume the Priority is a variable in your data source and not a label name?

 

If You are trying to do this in a Gallery so something like this should fix your problems:

 

Fill =

Switch(
  ThisItem.Priority,
  "Low", Green,
  "Medium",Orange,
  Red
)

 

 

View solution in original post

4 REPLIES 4
JRaasumaa
Memorable Member
Memorable Member


@Doors1980 wrote:

Hi All,

 

Totally new to this so figuring things out as I go... Smiley Tongue

 

I have a text label called "Priority" that's populated with "High", "Medium" or "Low" text from a SharePoint list. (Not a dropdown, just a single line of text column)

 

Dependant on this value I'd like to change another labels fill to either red, orange or green.

 

This is not working:

 

If( text(Priority.Text) = "Low" , Color.Green, text(Priority.Text) = "Medium", Color.Orange, Color.Red )

 

Cheers in advance.  


 

You should not need to wrap the Priority.Text in another text, it should work by simply referencing Priority.Text and comparing that value to "Low" "Medium" etc.

 

I would also suggest using a switch statement as it's much easier to write. Something like:

 

Switch(Priority.Text,"Low",Green,"Medium",Orange,Red)

Read more on switch here:

 

https://powerapps.microsoft.com/en-us/tutorials/function-if/

Doors1980
Helper I
Helper I

Thanks @JRaasumaa but no joy. Smiley Sad

 

Screenshot of error:

 

https://1drv.ms/i/s!AmrYzSj1K9FlgrhaCvoXWqQCnsNPcg

 

 

Anonymous
Not applicable

Hi @Doors1980

 

I assume the Priority is a variable in your data source and not a label name?

 

If You are trying to do this in a Gallery so something like this should fix your problems:

 

Fill =

Switch(
  ThisItem.Priority,
  "Low", Green,
  "Medium",Orange,
  Red
)

 

 

Thank you both very much for your time, that worked @Anonymous Smiley Tongue

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,484)