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 / Different color for da...
Power Apps
Answered

Different color for dates < Today()

(0) ShareShare
ReportReport
Posted on by 88

Hello community,

 

I have a calendar made out of labels in a gallery. I want to color the past dates with a different color so you see when dates are in the past.

 

I have on he Fill property of the labels :

If(DateValue(Concatenate(Label.Text,"/",Text(Year(Now())))) < Today(),Gray,Normal color)

 

So far its working for the dates but when we get near December, you see that January 2022 is also filled out to Gray as its still recognizes that 01/01/2022 is < Today().

 

I need help with figuring out a formula to only filter past dates but leave the dates for January next year.

 

Appreciate your help!

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,299 Most Valuable Professional on at

    Hi @StanP ,

    I assume your Label.Text is something like 25/3, 12/4, 15/5 (or backwards if you are from USA) - if so how does it show 2022? If it is a full date, why add the current year on the end. Anyway, I did a test with Option A as below

    With(
     {
     wDate: 
     DateValue(
     Label.Text & "/" & Year(Today())
     )
     },
     If(
     wDate < Today(),
     Gray,
     Green
     )
    )

     

    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.

     

  • StanP Profile Picture
    88 on at

    Thanks for the reply @WarrenBelz ,

     

    The app is a mock-up of a restaurant reservation app, I want to be able to reserve a spot for future dates at a restaurant, the label has a month/day as text because It does not look as good when you have year on it as well.

     

    When I click the label, it gathers the dates within a collection and and adds /year value to it so it can be patched to a SharePoint list.

     

    I want to be able to gray-out past dates but leave future dates open, with my expression it works but if we near December and try to book for January 2022, they are grayed out as well.

     

    The one you suggested does the same as mine 😞 , it grays out the months and dates before 06/10/2021(Today) but near December you'd want to book a date for January but that would be grayed out too.

  • Verified answer
    WarrenBelz Profile Picture
    156,299 Most Valuable Professional on at

    Hi @StanP ,

    Now I see the conundrum - you need a "next year" tick box or the like or your problem is unsolvable unless you want to assume that anything older than (say) six months ago is next year.

    With(
     {
     wDate: 
     DateValue(
     Label.Text & "/" & Year(Today())
     )
     },
     If(
     wDate < Today() && wDate > Today - 180,
     Gray,
     Green
     )
    )

     

    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.

  • WarrenBelz Profile Picture
    156,299 Most Valuable Professional on at

    Hi @StanP ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

    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.

  • StanP Profile Picture
    88 on at

    All good, @WarrenBelz  , your suggested idea to put a "range" on it is superb!

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
WarrenBelz Profile Picture

WarrenBelz 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 136 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 109 Super User 2026 Season 2

Last 30 days Overall leaderboard