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 / Compare dates from lis...
Power Automate
Answered

Compare dates from listItem

(0) ShareShare
ReportReport
Posted on by 4

Hello All,

 

I'm starting with Flow and I have some problem to make a basic action.

 

I have an item which has 3 metadatas :

- Start date (DateTime)

- End date  (DateTime)

- Deactivated (Bool)

 

I just want to update the deactivated value by this simple expression ==> If today is beetween the 2 dates, then 0, else 1

Which expression I have to use. I try to find some help on others posts but it does not work for me.

 

Sorry the screenshot is in french Smiley Very Happy

 

 

image.png

Categories:
  • v-yamao-msft Profile Picture
    Microsoft Employee on at

    Hi Yazid,

     

    I am not sure with the column type of “Deactivated (Bool)”. I assume that it should be a number column.


    To test this issue, I created a list with the three columns you mentioned. In my list, the column names are start, end, bool(number column type).


    Then I create a flow to update the bool column.


    The flow is configured likes below.


    The function I am using for the bool field is:

    if(and(greater(formatDateTime(utcnow(),'yyyy-MM-dd'),formatDateTime(items('Apply_to_each')?['start'],'yyyy-MM-dd')),less(formatDateTime(utcnow(),'yyyy-MM-dd'),formatDateTime(items('Apply_to_each')?['end'],'yyyy-MM-dd'))),'0','1')


    When today’s date is between start and end, it will return 0. If not, returns 1.

    3.PNG

     

    This function works fine on my side. Please have a try with it on your side.

     

    Best regards,
    Mabel Mao

  • Yazid Profile Picture
    4 on at

    Hello Mabel Mao,

     

    Thx for your answer !

     

    Just to clarify, My column is a bool when I wrote 0 or 1 it was for Yes or No 🙂 but it's the same so forget this point 

     

    Just one thing coz I had another error.

     

    I modify the line by changing the data name

     

    if(and(greater(formatDateTime(utcnow(),'yyyy-MM-dd'),formatDateTime(items('Apply_to_each')?['BeginDate'],'yyyy-MM-dd')),less(formatDateTime(utcnow(),'yyyy-MM-dd'),formatDateTime(items('Apply_to_each')?['EndDate'],'yyyy-MM-dd'))),'No','Yes')
    		

    but when I tried to save the flow, I received this error message :

     

    ==> The template validation failed: 'The repetition action(s) 'Apply_to_each' referenced by 'inputs' in action 'Update_item' are not defined in the template.'.

     

    Thx So much for your help !

  • Verified answer
    v-yamao-msft Profile Picture
    Microsoft Employee on at

    Hi Yazid,

     

    I am afraid that Boolean column cannot be updated currently by Flow. So you may get the error message.


    If you also try with a number column, I assume that it should work.

     

    Best regards,
    Mabel Mao

     

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
Mohsin Ali Profile Picture

Mohsin Ali 426

#2
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard