cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Change Icon Color based on Number Value (Simple!)

My app currently tracks the number of days since we last invoiced our client with a DateDiff function

DateDiff(DataCardValue12.SelectedDate,Today())

 

I have placed circle icons on my app that I want to change color based on how many days it has been since the invoice has been sent (like a color status update).

 

A green circle for most recent and red being a very long time.

 

It seems sooooo easy but I cannot figure it out. Here is my if statement in the fill property of a circle:

If('Number of Days' > 1, Green, LightGray)

 

*Number of Days is name of the text label where the DateDiff function is found

 

The error I get is that If statement is expecting a number but I've tried 'Number of Days'.Value and that doesn't work either.

 

Thanks for the help!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User II
Dual Super User II

Hi @zalandoe 

 

If(Value('Number of Days'.Text) > 1, Green, LightGray)

 

Regards,

Reza Dorrani

 

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
Dual Super User II
Dual Super User II

Hi @zalandoe 

 

If(Value('Number of Days'.Text) > 1, Green, LightGray)

 

Regards,

Reza Dorrani

 

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

Thanks so much! I thought I had tried that solution at one point and dismissed it completely!

Helper V
Helper V

 

help.png

 

Woah, that is great. Thanks!

haha oops he beat me to it

Hi Reza, 

 

I have same scenario of this problem but i cannot figure it out how to work. Can you also please help?

 

I have a TextInput box and a rectangle color box, i want to change the color based on the values of the text input. 

here is my code. but i cannot work on the between value of between <=0.5 and <=0.9. 

 

If(Value(TextInput2.Text) < 0.5, Red,
If(Value(TextInput2.Text) <=0.5 && Value(TextInput2.Text) <= 0.9, Yellow,
If(Value(TextInput2.Text) >=1, Green,
Black


)))

echodapogi_0-1612908891608.png

i need to do color coding in the box based on this formula. 

<0.4Red
<= 0.5 and <1Yellow
>=1Green

 

Thanks in Advance

 

Echo

 

Helpful resources

Announcements
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Kudoed Authors
Users online (81,705)