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

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Color changing items in dropdown by date.

(0) ShareShare
ReportReport
Posted on by 229

Hello,

 

So I'm not even sure this is possible but I figure I would see if anyone has any ideas. I want to see if I can have items gradually change colors by the date. They would start out green and by mid week they would be yellow and after 7 days would be red. Also I would be great if I could add a progress\deterioration Color bar showing the color change. 

 

I have a dropdown linked to a sheet on OneDrive with 12 machines in it. These machines need to be cleaned at least once a week, but we have several people across different shifts. I want to make it easy for people to see which machines have been recently cleaned. weather its in the dropdown list or I could add icons or labels that represent the machines on the screen. I pull the items in the dropdown from one (Table "VH_Etcher_Info") with (Field: "Name:") and I Submit the record to another (table "Etcher_Cleaning_Sheet") with (Field: "Machine Name").

 

Let me know if you need more info or screen shots on the app.

Categories:
I have the same question (0)
  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at
    Re: Color changing items in dropdown by date.

    Maybe instead of a dropdown use a gallery.   And set the background (fill) and text (color) based on the date or day of the week.  That would be an instant visual and they could see all computers at once.

     

    Here is an article on getting the various date components.

     

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-datetime-parts

  • Chrisguff12 Profile Picture
    229 on at
    Re: Color changing items in dropdown by date.

    Thanks, JR-BejeweledOne for the date components link. I will be need it for another app I'm making.

     

    I am ok with using a gallery or anything else make this work. but I don't want to set a color to a specific day of the week. I want the object/Label or what ever to change as time passes.

    Example:

    on Monday I clean machine A1 then the object will turn Green. Then by Friday the object will have automatically changed to more of a yellow/reddish color. Then if the machine hasn't been cleaned by Monday I don't want it to turn back to green. It will only change back to green after someone submits a cleaning report. Similar to a battery, it will only be at 100% after you charge it. 

     

    And thinking about batteries. If there is not a way to have an object change colors over time. Is there a way to add a percentage label that would go down over time. Then I could change the color of the percentage label based on its number?

  • Verified answer
    JR-BejeweledOne Profile Picture
    5,836 Moderator on at
    Re: Color changing items in dropdown by date.

    You could do the percentage thing too.  Either would work, but you will have to have some sort of date/time calculation.

     

    Consider this:

     

    On App Start set a variable containing the current Date Time, using the Now() function.

     

    Collect your computers into a collection and use the AddColumn function to add a column that pulls in the date/time from the last cleaning report.

     

    Use this collection as your gallery data source.    In the fill statement, you can do a calculation, something like this:

     

    If(

    varNow - datetime field = XXXNumber, color,

    DefaultColor)

     

    Here is an example.   I don't have any date/time calculations here but you can see how it could be done.  The numbers are just random numbers I selected.   In the gallery you don't have to display any fields but the computer name.

     

    GalleryColors.png

     

    If you haven't used the AddColumns function before, here is a link for you:

     

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-table-shaping

  • Verified answer
    Chrisguff12 Profile Picture
    229 on at
    Re: Color changing items in dropdown by date.

    JR-BejeweledOne thanks again for taking the time to try and help me. I was able to get the get the color change by date using your help and this other thread. I just hade to expand a little to get more color changes.

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Change-color-of-text-displayed-in-gallery-based-on-dates-overdue/m-p/600348#M188748

     

    I made a gallery with the machines and changing there color property of the machines and linking the to date I used this formula:

     

    If(DateDiff(ThisItem.'Last Time Cleaned',Today())<=1,Color.DarkGreen,DateDiff(ThisItem.'Last Time Cleaned',Today())<=2&&DateDiff(ThisItem.'Last Time Cleaned',Today())<=3,Color.Green,DateDiff(ThisItem.'Last Time Cleaned',Today())<=4&&DateDiff(ThisItem.'Last Time Cleaned',Today())<=5,Color.Yellow,DateDiff(ThisItem.'Last Time Cleaned',Today())<=6&&DateDiff(ThisItem.'Last Time Cleaned',Today())<=7,Color.Orange,DateDiff(ThisItem.'Last Time Cleaned',Today())>=7,Color.Red)

     

    Now my gallery looks like this and the machine change color as the days pass.

    Chrisguff12_7-1612566137074.png

     

    Thanks again for your help.

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at
    Re: Color changing items in dropdown by date.

    This is what I like best about our community here.  Not that someone else necessarily solves an issue for you, although that does happen, but that it more often guides us take someones advice and thoughts and use them to make the solution that works perfectly for us. 

     

    I am glad you got it working!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 652 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 410 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 236

Last 30 days Overall leaderboard