Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Change Text Color based on 3 Date values in Power Automate

(0) ShareShare
ReportReport
Posted on by 6

Requirements:

Create HTML Report from items that are expiring in 45 days and change the text color based on 3 date values.

 

Example:

Items expiring in 45 Days = Green.

Items that are expiring 30 Days = Orange

Items that are expiring 20 Days = Red

 

Issue:

The following Expression is working for two items. Can't seem to capture items expiring in 20 days. Need help on expanding this expression to include items expiring in 20 days (red)...Thanks

 

If (empty(item()?['EndDate']), '', if( lessOrEquals( item()?['EndDate'] , addDays(formatDateTime(utcNow(), 'yyyy-MM-dd'), 30, 'yyyy-MM-dd')),
concat('<span style="color:orange">', item()?['EndDate'], '</span>'),
concat('<span style="color:Green">', item()?['EndDate'])))

 

 

 

 

  • robayala Profile Picture
    6 on at
    Re: Change Text Color based on 3 Date values in Power Automate

    @ManishSolanki 

    That worked! Awesome! Thank you so much for this and your quick reply. Have a great weekend.

  • Verified answer
    ManishSolanki Profile Picture
    15,085 Super User 2025 Season 1 on at
    Re: Change Text Color based on 3 Date values in Power Automate

    Hi @robayala 

     

    Please use the below expression:

     

    If (empty(item()?['EndDate']), '', if(lessOrEquals( item()?['EndDate'] , addDays(formatDateTime(utcNow(), 'yyyy-MM-dd'), 20, 'yyyy-MM-dd')),
    concat('<span style="color:red">', item()?['EndDate'], '</span>'),if( lessOrEquals( item()?['EndDate'], addDays(formatDateTime(utcNow(), 'yyyy-MM-dd'), 30, 'yyyy-MM-dd')),concat('<span style="color:orange">', item()?['EndDate'], '</span>'),concat('<span style="color:Green">', item()?['EndDate']))))

     

    Please let me know if you face any problem & remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492