Forum Discussion
SebastianCostas
3 years agoFrequent Visitor
Getting time passed between two dates based on another field
First of all thanks a lot to whoever can help me. The information I need to calculate is in a single table, and I need to get a column with this value for each row. I have Purchase Requisitio...
- 3 years ago
Please download my sample file to check my solution.
I first add an Index column with Power Query, then use below DAX to calculate the spent hours in a calculated column.
Time Taken = IF ( 'Table'[Index] = 1, DATEDIFF ( 'Table'[PR_Submited], 'Table'[PR_Approved_Date], HOUR ), DATEDIFF ( CALCULATE ( MAX ( 'Table'[PR_Approved_Date] ), ALLEXCEPT ( 'Table', 'Table'[PR_ID] ), 'Table'[Index] = EARLIER ( 'Table'[Index] ) - 1 ), 'Table'[PR_Approved_Date], HOUR ) )Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
v-jingzhang
3 years agoCommunity Support
Please download my sample file to check my solution.
I first add an Index column with Power Query, then use below DAX to calculate the spent hours in a calculated column.
Time Taken =
IF (
'Table'[Index] = 1,
DATEDIFF ( 'Table'[PR_Submited], 'Table'[PR_Approved_Date], HOUR ),
DATEDIFF (
CALCULATE (
MAX ( 'Table'[PR_Approved_Date] ),
ALLEXCEPT ( 'Table', 'Table'[PR_ID] ),
'Table'[Index]
= EARLIER ( 'Table'[Index] ) - 1
),
'Table'[PR_Approved_Date],
HOUR
)
)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.