Forum Discussion

Danyal's avatar
Danyal
Regular Visitor
3 years ago

Row based time calculation

Good Day everyone

 

I need a measure where i can show hours/mins 1 customer took from one to another move?

 

 

 

 

data_source_veiw


P_ID      Customer            Move_Name    Move_ID  change_time

9250botanaNew 37/24/2023 6:25
9250botanaHold57/24/2023 6:29
9118GysaNew 37/23/2023 13:08
9118GysaApproved117/23/2023 13:08
9118GysaWon27/23/2023 13:11
9118GysaBusiness157/24/2023 7:03
9275hanaNew 137/24/2023 10:45
9275hanaHold57/24/2023 10:46
9157hhmaakka2New 37/20/2023 6:50
9157hhmaakka2 Approved117/20/2023 9:25
9157hhmaakka2 Won27/20/2023 10:21
6748iflashNew 37/24/2023 13:27
6748iflashHold57/24/2023 13:28
9116coffeeNew 37/23/2023 8:48
9116coffeeQualified107/23/2023 8:48
9116coffeeWon27/23/2023 8:24
9116coffeeBusiness157/23/2023 8:23
9146w2fgiiNew 37/20/2023 7:17
9146w2fgiiHold57/20/2023 7:23
9146w2fgiiQualified107/20/2023 7:33
9146w2fgii Approved117/20/2023 7:35

2 Replies

  • Danyal's avatar
    Danyal
    Regular Visitor

    HI SamInogic ,

     

    Thank you so much for helping out.

     

    the provided measure seems fine but i doubt one thing, lets say one Move has 3 or more ids as one move will go under sevaral moves, so the goal is to calculate hours or minuts that a customer has spent in each move or from one to another move.

    so the ultimate result would be i will create 2 slicers to select desied moves and it will show the hours or mintus that customer and move has taken.

     

    thanks again for your input.

    😊

  • Hi Danyal ,

    As per our understanding, you want to calculate the date difference between dates of “change_time” column as mentioned in the “data_source_veiw” table.

    So, you can try to create a measure with below DAX expression,

    diff =

        var _min=CALCULATE(MIN(data_source_veiw[change_time]),ALLEXCEPT('data_source_veiw',data_source_veiw[P_ID]))

        var _max=CALCULATE(MAX(data_source_veiw[change_time]),ALLEXCEPT('data_source_veiw',data_source_veiw[P_ID]))

    return

        DATEDIFF(_min,_max,MINUTE)

     

    Please refer to the below screenshot for the same,

     

    Thanks!

    Inogic Professional Services Division

    Power Platform and Microsoft Dynamics 365 CRM Development – All under one roof!

    Drop an email at [email protected]

    Services:  http://www.inogic.com/services/

    Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/