Forum Discussion

sanjanarama's avatar
sanjanarama
Resolver I
4 years ago
Solved

difference between current time and datetime column excluding weekend

I wanted result in days and hours format where result is ----- difference of current date time and create date time column , excluding weekend   create date/time result 3/3/22 4:20 AM 6 day...
  • v-chenwuz-msft's avatar
    4 years ago

    Hi sanjanarama ,

     

    Try this expression:

    assum today is 2022.3.15 =
    VAR _today =
        DATE ( 2022, 3, 15 )
    VAR _workday =
        COUNTROWS (
            FILTER ( CALENDAR ( [create date/time], _today ), WEEKDAY ( [Date], 2 ) < 6 )
        )
    VAR _time_hour =
        DATEDIFF ( [create date/time].[Date], [create date/time], HOUR )
    RETURN
        _workday & " days " & _time_hour & " hours"
    

    result:

     

    Pbix in the end you can refer.

    Best Regards

    Community Support Team _ chenwu zhu

     

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