Forum Discussion

mina97's avatar
mina97
Helper III
2 years ago
Solved

date difference with one simple condition

hey i have the following data    order sumitied date last action date status 216 12/10/2023 13/10/2023 sumitied 216 13/10/2023 13/10/2023 returned to client 216 20/10/2023 21...
  • v-zhangti's avatar
    2 years ago

    Hi, mina97 

     

    You can try the following methods. Create a new date table.

    Date = CALENDAR(MIN('Table'[sumitied date]),MAX('Table'[last action date]))

    Measure1 = 
    Var _day1=CALCULATE(MAX('Table'[last action date]),FILTER(ALL('Table'),[status]="returned to client"))
    Var _day2=CALCULATE(MAX('Table'[last action date]),FILTER(ALL('Table'),[status]="resubmited"))
    Return
    CALCULATE(COUNT('Date'[Date]),FILTER(ALL('Date'),[Date]>=_day1&&[Date]<=_day2&&[Weekday]<>5&&[Weekday]<>6))
    Measure2 = 
    Var _day1=CALCULATE(MAX('Table'[last action date]),FILTER(ALL('Table'),[status]="returned to client"))
    Var _day2=CALCULATE(MAX('Table'[last action date]),FILTER(ALL('Table'),[status]="resubmited"))
    Return
    DATEDIFF(_day1,_day2,DAY)

    Is this the result you expect? Please see the attached document.

     

    Best Regards,

    Community Support Team _Charlotte

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