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 Automate / Conditional Formatting...
Power Automate
Unanswered

Conditional Formatting of dates in power automate

(0) ShareShare
ReportReport
Posted on by 2

I am trying to make HTML table from excel sheet in automate, I have converted number date into date format using this expression 

if(empty(item()?['Customer Due Date']),null,addDays('1899-12-30',int(item()?['Customer Due Date']),'yyyy-MM-dd'))
Now I want to apply conditional formatting like if date is less than currentUTC then color should be red, otherwise green.
how to achieve this in HTML table ?

 

 
Categories:
  • Expiscornovus Profile Picture
    33,997 Most Valuable Professional on at

    Hi @prasannaamle30,

     

    Try something like a style tag in your Select action.


    Below is an example

     

    Value field in the Select

    <p style="color:@{if(less(item()?['CustomerDueDate'], utcNow()), 'red', 'green')}">@{if(empty(item()?['CustomerDueDate']), null, item()?['CustomerDueDate'])}</p>

     

    Output with a couple of replace functions in the Send an email v2 action

    replace(replace(replace(body('Create_HTML_table'),'&lt;','<'),'&quot;','"'),'&gt;','>')

     

    duedate_colouring.png

  • prasannaamle30 Profile Picture
    2 on at

    Hi, thanks for your help but problem is dates are in number format and I want to convert  that numbers to dates and at the same time I want to add conditional formatting, If I try to convert numbers into dates in compose  and then pass that output for conditional formatting then it is showing as an error. How to resolve this ?

  • Expiscornovus Profile Picture
    33,997 Most Valuable Professional on at

    Hi @prasannaamle30,

     

    My example was just to show how you could use HTML in a Select. You could also use the expression you used earlier in that same type of setup.

     

    I have adapted my example to use your number expression instead. Also updated it to use a concat function as well (makes copy/pasting into the expression tab a bit easier)

     

    Can you try the below in the Select instead? (add via expression tab)

     

    concat('<p style="color:', if(empty(item()?['Customer Due Date']),null,if(less(addDays('1899-12-30',int(item()?['Customer Due Date']),'yyyy-MM-dd'), utcNow()), 'red', 'green')), '">', if(empty(item()?['Customer Due Date']),null,addDays('1899-12-30',int(item()?['Customer Due Date']),'yyyy-MM-dd')), '</p>')

     

     

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

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 273 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 235

#3
David_MA Profile Picture

David_MA 172 Super User 2026 Season 2

Last 30 days Overall leaderboard