Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Create Array lookup in Query

 

I am trying to measure TAT. To do so, I need to calculate how long an item was in each queue using only the time an item entered each queue.  In excel, I used an array to return the min Entered Queue Date that is greater than the current row's Entered Queue Date where the Name matches. How do I do this in PowerBI Query?

 

Sample Data set:  Name  and Entered Queue exist. I am trying to create the Exit Queue or a Time in Queue column instead.

 

NameEntered QueueExit Queue
321Z279_00JWH2BWP000B3S7/9/2018 10:547/11/2018 13:27
321Z279_00JWH2BWP000B3S7/11/2018 13:277/12/2018 14:58
321Z279_00JWH2BWP000B3S7/12/2018 14:587/17/2018 9:23
321Z279_00JWH2BWP000B3S7/17/2018 9:237/18/2018 9:00
321Z279_00JWH2BWP000B3S7/18/2018 9:008/15/2018 12:59
321Z279_00JWH2BWP000B3S8/15/2018 12:598/15/2018 13:25
321Z279_00JWH2BWP000B3S8/15/2018 13:258/31/2018 13:30
321Z279_00JWH2BWP000B3S8/31/2018 13:309/13/2018 10:34
321Z279_00JWH2BWP000B3S9/13/2018 10:349/19/2018 13:17
321Z279_00JWH2BWP000B3S9/19/2018 13:17 
321Z15Z_00ECD8YEZ001N3Y4/10/2018 11:324/10/2018 13:17
321Z15Z_00ECD8YEZ001N3Y4/10/2018 13:17 
321Z189_00F5DTK02000F2L1/13/2018 11:331/13/2018 11:36
321Z189_00F5DTK02000F2L1/5/2018 8:231/13/2018 11:31
321Z189_00F5DTK02000F2L1/13/2018 11:36 
321Z189_00F5DTK02000F2L1/13/2018 11:311/13/2018 11:33
321Z189_00F5DTK02000F2L1/3/2018 12:231/5/2018 8:23

 

Thanks.

  • You can use this calculated column:

     

    =
    CALCULATE (
        MIN ( Table1[Entered Queue] ),
        ALLEXCEPT ( Table1, Table1[Name] ),
        Table1[Entered Queue] > EARLIER ( Table1[Entered Queue] )
    )

2 Replies

  • You can use this calculated column:

     

    =
    CALCULATE (
        MIN ( Table1[Entered Queue] ),
        ALLEXCEPT ( Table1, Table1[Name] ),
        Table1[Entered Queue] > EARLIER ( Table1[Entered Queue] )
    )
    • Anonymous's avatar
      Anonymous
      Not applicable

      LivioLanzo, 

      Its so simple and beautiful. It works perfectly. Thank you!