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 / Compare two date on so...
Power Apps
Answered

Compare two date on some column.

(0) ShareShare
ReportReport
Posted on by 250

Hey guys.

I have a table as sure and need to compare the days between the date for the some user.

The table is in a gallery.

User NamePc UsedDateStatut
User 1HP06/22/2022 (Compare this)Good
User 2DELL06/21/2022 
User 1ASUS07/21/2022 (To this, days between) 
Categories:
  • WiZey Profile Picture
    3,023 Moderator on at

    Hello @loopingmurdock ,

     

    How do you want to compare your dates? Would something like « date1 = date2 » suffice?

     

    You can extract the two dates using two "LookUp()" like this :

     

    If(LookUp(Table, And(UserName = "User1", 'Pc Used' = "HP")).Date = 
    LookUp(Table, And(UserName = "User1", 'Pc Used' = "ASUS")).Date,
    //Do something if equals,
    //Do something else if no equals)

     

  • loopingmurdock Profile Picture
    250 on at

    Thanks, Just compare the days between, but what if the pc used is the some? will that choice the some date the first one

  • Verified answer
    WiZey Profile Picture
    3,023 Moderator on at

    I assumed the columns "User" and "Pc Used" acted as unique key in your table. But in the case "User" and "Pc Used" share the exact same values with multiple records, you can try something like this:

     

    With({FirstDateToCompare:LookUp(Table, And(UserName = "User1", 'Pc Used' = "HP")).Date},
    If(IsBlank(LookUp(Table, And(UserName = "User1", 'Pc Used' = "HP", Date > FirstDateToCompare)).Date,
    //Do something if equals,
    //Do something else if no equals))

     

    If your goal is to know the number of days between two dates, try using "DateDiff()" as follow:

     

    With({FirstDateToCompare:LookUp(Table, And(UserName = "User1", 'Pc Used' = "HP")).Date},
     With({SecondDateToCompare:LookUp(Table, And(UserName = "User1", 'Pc Used' = "HP", Date > FirstDateToCompare).Date},
     If(IsBlank(SecondDateToCompare),
     0,
     DateDiff(SecondDateToCompare,FirstDateToCompare)
     )
     )
    )

     

  • loopingmurdock Profile Picture
    250 on at

    Thank you @WiZey 

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 Apps

#1
11manish Profile Picture

11manish 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard