Forum Discussion

learner03's avatar
learner03
Post Partisan
4 years ago
Solved

Summarise time

I am looking for measure based on SUM of Total Scans/total Time. But here, Total time for the day will be calculated based on SUM of  MIN and Max time of all individual SO in that day. 

Below table gives a sample dataset of only one day, but there will be data everyday.

Example- SO00307980 started at 15:58 and finished at 17:20, so only this amount of time will be calculated + SO00308243 min max+ etc etc.

TimestampDateSOTotal Scan
3/12/2021 17:203-Dec-21SO003079801
3/12/2021 17:193-Dec-21SO003079801
3/12/2021 17:183-Dec-21SO003079801
3/12/2021 17:173-Dec-21SO003079801
3/12/2021 17:113-Dec-21SO003079801
3/12/2021 16:003-Dec-21SO003079803
3/12/2021 15:583-Dec-21SO003079801
3/12/2021 14:173-Dec-21SO003082433
3/12/2021 14:163-Dec-21SO003082433
3/12/2021 14:153-Dec-21SO003082433
3/12/2021 14:153-Dec-21SO003082431
3/12/2021 14:143-Dec-21SO003082431
3/12/2021 14:023-Dec-21SO003082453
3/12/2021 14:023-Dec-21SO003082453
3/12/2021 13:533-Dec-21SO003082452
3/12/2021 13:453-Dec-21SO003082453
3/12/2021 13:443-Dec-21SO003082453
3/12/2021 14:473-Dec-21SO003082463
3/12/2021 14:473-Dec-21SO003082463
3/12/2021 14:373-Dec-21SO003082463
3/12/2021 14:243-Dec-21SO003082463
3/12/2021 14:223-Dec-21SO003082463
3/12/2021 14:193-Dec-21SO003082463
3/12/2021 15:113-Dec-21SO003082813
3/12/2021 15:033-Dec-21SO003082813
3/12/2021 14:593-Dec-21SO003082813
3/12/2021 14:443-Dec-21SO003082813
3/12/2021 14:423-Dec-21SO003082813
3/12/2021 14:423-Dec-21SO003082811
3/12/2021 14:413-Dec-21SO003082812
3/12/2021 14:403-Dec-21SO003082811
3/12/2021 9:443-Dec-21SO003082823
3/12/2021 9:433-Dec-21SO003082823
3/12/2021 9:423-Dec-21SO003082823
3/12/2021 9:423-Dec-21SO003082823
3/12/2021 9:403-Dec-21SO003082823
3/12/2021 9:393-Dec-21SO003082823
3/12/2021 9:383-Dec-21SO003082823
  • TheoC's avatar
    TheoC
    4 years ago

    Hi learner03 refer to attached.  The output is as per below. 

    Let me know if you want me to run you through the above.

     

    The Total Scans measure counts each record by the SO group.

     

    Total Scans = CALCULATE ( COUNTROWS ( 'Table' ) , ALLEXCEPT ( 'Table' ,'Table'[SO] ) )

    The division is both by Scan Rate Mins and Scan Rate Secs and it's just the Output Mins or Output Secs divided by the Total Scans.

     

    All the best!

    Theo 🙂 

     

     

8 Replies

  • TheoC's avatar
    TheoC
    Community Champion

    Hi learner03 

     

    Please see attached file for below output:

    You will need to create the following measures:

     

    Duration = 

    VAR _Min = CALCULATE ( MIN ('Table'[Timestamp] ) , ALLEXCEPT ( 'Table' ,'Table'[SO] ) )
    VAR _Max = CALCULATE ( MAX ('Table'[Timestamp] ) , ALLEXCEPT ( 'Table' ,'Table'[SO] ) )
    VAR _TotTime = _Max - _Min

    RETURN

    _TotTime
    Output Mins = 

    VAR _1 = INT ( HOUR ( [Duration] ) ) * 60
    VAR _2 = INT ( MINUTE( [Duration] ) )
    VAR _3 = SECOND ( [Duration] ) / 60
    VAR _Secs = _1 + _2 + _3

    RETURN

    _Secs
    Output Secs = 

    VAR _1 = [Output Mins] * 60

    RETURN

    _1

    Hope this helps! 

    Theo 🙂

     

    • learner03's avatar
      learner03
      Post Partisan

      TheoC Thanks. But, where is it taking Total sum of Scan into consideration?
      The output need to be total scans divide by total time.
      So, the output be like-

      DateSOtotal time           total Scans                            Scan rate=Total scan/total time   
              
              
              
              
              
      • TheoC's avatar
        TheoC
        Community Champion

        Hi learner03 refer to attached.  The output is as per below. 

        Let me know if you want me to run you through the above.

         

        The Total Scans measure counts each record by the SO group.

         

        Total Scans = CALCULATE ( COUNTROWS ( 'Table' ) , ALLEXCEPT ( 'Table' ,'Table'[SO] ) )

        The division is both by Scan Rate Mins and Scan Rate Secs and it's just the Output Mins or Output Secs divided by the Total Scans.

         

        All the best!

        Theo 🙂 

         

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi learner03 ,

     

    Please simply try:

    Total Time (minutes) = DATEDIFF(MIN('Table'[Timestamp]),MAX('Table'[Timestamp]),MINUTE)
    Total Scans = SUM('Table'[Total Scan]) 
    Scan rate = DIVIDE([Total Scans],[Total Time (minutes)])

    Shown in Matrix visual:

     

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

    • learner03's avatar
      learner03
      Post Partisan

      Anonymous Yes I used, this works only if the data is of one day. But, it there are multiple days and I want to aggrregate time day-wise, then it takes minimum time and max time of that day, where as I need min max time based on wash  sales order of that day (example- if there are 5 SO in one day then, mini max of SO1+Min Max of SO2....so on) and then calculate scan rate.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi learner03 ,

     

    Could you tell me if your problem has been solved? If it is, kindly Accept a helpful post as the solution. More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

     

    Best Regards,
    Eyelyn Qin