Calculate the difference between two dates with different status:

Hello,
I have 2 status for the same order (1 and 2). each status has its timestamp.
I want to calculate the difference between those two statuses in days:
I did like this
Status 1
ifelse(
{orderinfo_orderstatus_text}=‘1’,
{status_timestamp},
NULL)
Status 2
ifelse(
{orderinfo_orderstatus_text}=‘2’,
{status_timestamp},
NULL)
Then
dateDiff({STATUS1},{STATUS2},‘DD’)

however it does not work. I understand why (the fact that status 1 will be null for 2 and vice versa), but I can not think another way of doing it

Hi @remba87

Presuming you will be visualizing this with the order shown in the Pivot table you can do a max on both the Status 1 and Status 2 in your datediff calculated field and see if that would work

Hello Remba,

See if this helps - Calculate Conditional Timespan Between Two Timestamps Within Group - #6 by sagmukhe

hope this gives some idea.

Cheers,
Deep

2 Likes

thank you for your help!