Hi,
I have been trying to customize a SP list using power apps. In that, I want to find the aging between start and end date in terms of days and hours. I used the below formula for aging in days.
If(IsBlank(DateValue3),DateDiff(DateValue(DateValue2),Today()),DateDiff(DateValue(DateValue2),DateValue3)) where datevalue2 is created date and datevalue3 is closure date.
I tried using the same formula for hours but it is not working. Could someone please tell me what formula to use?
PS: The dates are in the format of Date and time formats as shown in the below screenshot
Hi @JayanthanJ
This formula gets you a label which shows the difference between two times and displays in hours, you could modify that for your needs.
I've attached a sample app to show you how this would work for both days and hours.
If(
IsBlank(DateValue1.SelectedDate),
DateDiff(
DateTime(
Year(DateValue2.SelectedDate),
Month(DateValue2.SelectedDate),
Day(DateValue2.SelectedDate),
Hour(
DateAdd(
Today(),
HourValue2.Selected.Value,
Hours
)
),
Minute(
DateAdd(
Today(),
MinuteValue2.Selected.Value,
Minutes
)
),
0
),
DateTime(Year(Today()), Month(Today()),Day(Today()),Hour(Now()),Minute(Now()),0),
Hours
),
//Difference between today and today but hours are different based on selection
DateDiff(
DateTime(
Year(Today()),
Month(Today()),
Day(Today()),
Hour(
DateAdd(
Today(),
HourValue1.Selected.Value,
Hours
)
),
Minute(
DateAdd(
Today(),
MinuteValue1.Selected.Value,
Minutes
)
),
0
),
DateTime(
Year(Today()),
Month(Today()),
Day(Today()),
Hour(
DateAdd(
Today(),
HourValue2.Selected.Value,
Hours
)
),
Minute(
DateAdd(
Today(),
MinuteValue2.Selected.Value,
Minutes
)
),
0
),
Hours
)
) & " Hours"
Cheers,
Sancho
@iAm_ManCat |
Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you! |
Thanks! |
User | Count |
---|---|
259 | |
110 | |
97 | |
52 | |
39 |