Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Datediff Question

Hello,

 

Taking this COD_UID as 

 

How can I perform a datediff in seconds between the dates with the status shipped and the dates with the status Packed for the same COD_UID?7

 

Sample here: Sample 

 

  • Hi Anonymous ,

     

    Please try:

    Measure = 
    var _a = CALCULATE(MAX('Table'[Picking Time_]),FILTER('Table',[STATUS]="SHIPPED"))
    var _b = CALCULATE(MAX('Table'[Picking Time_]),FILTER('Table',[STATUS]="PACKED"))
    return DATEDIFF(_a,_b,SECOND)

    Output:

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • Hi Anonymous ,

     

    Please try:

    Measure = 
    var _a = CALCULATE(MAX('Table'[Picking Time_]),FILTER('Table',[STATUS]="SHIPPED"))
    var _b = CALCULATE(MAX('Table'[Picking Time_]),FILTER('Table',[STATUS]="PACKED"))
    return DATEDIFF(_a,_b,SECOND)

    Output:

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.