cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jean_9681
Helper III
Helper III

Change label color based on column value

Hi All,


I would like to change a label color based on a column value, could anyone guide with this please

Column 1 - Budget
Column 2 - Expense

As an example - the number 100 is just an example

If Budget is 100 and Expense is less then 100 i want the label color Green
If Budget is 100 and Expense is slightly over 100 for ex-120 i want the label color Yellow
If Budget is 100 and Expense is 130 and above i want the label color Red

In case if  the above request is not achievable then please suggest how to change the color of the Expense value to Red is its greater than the Budget value.

Thanks for your time. 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Jean_9681 ,

This should show you the colours

With(
   {wVar: Expense - Budget},
   If(
      wVar <=0, 
      Green,
      wVar < 30,
      Yellow,
      Red
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

View solution in original post

3 REPLIES 3
Drrickryp
Super User
Super User

@Jean_9681 

With({bg:Budget=100},

Switch(bg & Expense,<100,Green,>=130,Red,Yellow))

WarrenBelz
Super User
Super User

Hi @Jean_9681 ,

This should show you the colours

With(
   {wVar: Expense - Budget},
   If(
      wVar <=0, 
      Green,
      wVar < 30,
      Yellow,
      Red
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

Jean_9681
Helper III
Helper III

@WarrenBelz Thank you, it worked exactly the way i wanted it to.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,255)