web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Change Icon Color base...
Power Apps
Answered

Change Icon Color based on Number Value (Simple!)

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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!

 

powerapps.PNG
dots.PNG
Categories:
  • Verified answer
    RezaDorrani Profile Picture
    12,145 on at

    Hi @Anonymous 

     

    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

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

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

  • TheRobRush Profile Picture
    11,128 Moderator on at

     

    help.png

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Woah, that is great. Thanks!

  • TheRobRush Profile Picture
    11,128 Moderator on at

    haha oops he beat me to it

  • echodapogi Profile Picture
    516 on at

    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

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard