Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

How to apply color to the date field according to the criteria

(0) ShareShare
ReportReport
Posted on by

My data source is coming from sharepoint list. Which has field called "RenewalDate".

I see the data in the gallery view.

 

I want to apply color for the following criteria :

If RenewalDate is equal to today date OR less than than today date then apply red color font (this will indicate user that its already expired)

 

If RenewalDate is greater than today and within the date range of Today+15 days then Blue color font (this will indicate  user to prepare as its approaching to expire date)

 

If this above criteria not there, then let the font color to be blank as normal.

 

Please guide how to apply this on the gallery data.

  • Verified answer
    BCBuizer Profile Picture
    21,991 Super User 2025 Season 1 on at
    Re: How to apply color to the date field according to the criteria

    Hi @MIA27 ,

     

    Apologies, left the wrong column name in the formula while I was testing. Please use: 

    With(
     {
     _Renewal: DateDiff(
     Now(),
     ThisItem.RenewalDate
     )
     },
     If(
     _Renewal < 0,
     Red,
     _Renewal < 16,
     Blue,
     Black
     )
    )

     

    This is how it looks in my test (current date 28/07/2022):

    BCBuizer_0-1658998429878.png

     

  • MIA27 Profile Picture
    on at
    Re: How to apply color to the date field according to the criteria

    I tried your advised code, as below

    In gallery selected the label, and in its color property paste the your advised code, the result is all red, You can note in the data that test records are of 2016 and some of 28/7/2022.

     

    MIA27_0-1658945295715.png

     

     

     

    Please advise 

  • BCBuizer Profile Picture
    21,991 Super User 2025 Season 1 on at
    Re: How to apply color to the date field according to the criteria

    Hi @MIA27 ,

     

    In your gallery, select the labels you wish to use this conditional formatting and set the Color property to:

    With(
     {
     _Renewal: DateDiff(
     Now(),
     ThisItem.Created
     )
     },
     If(
     _Renewal < 0,
     Red,
     _Renewal < 16,
     Blue,
     Black
     )
    )

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard