Forum Discussion

omillan's avatar
omillan
New Member
3 years ago
Solved

Allocate a unique reference number / Generate Start Time or End Time for a set of values

Hello all,

 

I have been trying to find for the past 3-4 days a formula that can generate a Start Time & End TIme for a dataset that will be automatically adding positions every day. So far I have only been able to find the Earlier function but its keeps bringing me the absolute earliert value with the same "Queue" name. I am looking to consolidate each run ("ID") into a unique job number. In other words, the below example the first 3 lines, it would be job #1, then ID=4, would be job#2 and so on. 

Any ideas on how to solve this? I have tried countrows(), earlier(), min() but I guess not the right way. The closest has been:

Start Time =
MINX(
    FILTER(
        'tfriesen_test_webhook',
        'tfriesen_test_webhook'[Queue] = EARLIER('tfriesen_test_webhook'[Queue])
    ),
    'tfriesen_test_webhook'[Modified]
)

 

 

IDQueueModifiedStart TimeEnd Time
1CreditLimitWF13/07/2023 01:04:5613/07/2023 01:04:5613/07/2023 01:48:20
2CreditLimitWF13/07/2023 01:13:2913/07/2023 01:04:5613/07/2023 01:48:20
3CreditLimitWF13/07/2023 01:48:2013/07/2023 01:04:5613/07/2023 01:48:20
4LGP_Database13/07/2023 02:06:0613/07/2023 02:06:0613/07/2023 02:06:06
5CreditLimitWF13/07/2023 02:11:0613/07/2023 02:11:0613/07/2023 02:11:54
6LGP_Database13/07/2023 02:11:5413/07/2023 02:11:5413/07/2023 02:11:54
7Creditreform_URLs13/07/2023 04:00:2113/07/2023 04:00:2113/07/2023 04:00:26
8Creditreform_URLs13/07/2023 04:00:2313/07/2023 04:00:2113/07/2023 04:00:26
9Creditreform_URLs13/07/2023 04:00:2613/07/2023 04:00:2113/07/2023 04:00:26
10CreditReform_CustomerData13/07/2023 04:01:3613/07/2023 04:01:3613/07/2023 04:02:29
11CreditReform_CustomerData13/07/2023 04:02:0313/07/2023 04:01:3613/07/2023 04:02:29
12CreditReform_CustomerData13/07/2023 04:02:2913/07/2023 04:01:3613/07/2023 04:02:29
13Logistics_Gefahrengutpruefung13/07/2023 20:18:1213/07/2023 20:18:1213/07/2023 20:19:09
14Logistics_Gefahrengutpruefung13/07/2023 20:18:4313/07/2023 20:18:1213/07/2023 20:19:09
15Logistics_Gefahrengutpruefung13/07/2023 20:19:0913/07/2023 20:18:1213/07/2023 20:19:09
16CreditLimitWF13/07/2023 20:16:5313/07/2023 20:16:5313/07/2023 20:16:53
17Logistics_Gefahrengutpruefung13/07/2023 20:19:3613/07/2023 20:19:3613/07/2023 20:21:01
18Logistics_Gefahrengutpruefung13/07/2023 20:20:0413/07/2023 20:19:3613/07/2023 20:21:01
19Logistics_Gefahrengutpruefung13/07/2023 20:21:0113/07/2023 20:19:3613/07/2023 20:21:01
  • omillan's avatar
    omillan
    3 years ago

    Thank you Ryan, this is amazing - you did that in 2 minutes and I have been working on it for 3 days.

    Here below the solution with 4 columns:

     

    job 1 = if( maxx(FILTER('Table','Table'[Id]=EARLIER('Table'[Id])-1),'Table'[Queue])='Table'[Queue],0,1)
    job2 = sumx(FILTER('Table','Table'[Id]<=EARLIER('Table'[Id])),'Table'[job 1])
    start = CALCULATE(min('Table'[Modified Date]),ALLEXCEPT('Table','Table'[job2]))
    end = CALCULATE(max('Table'[Modified Date]),ALLEXCEPT('Table','Table'[job2]))
     
    If possible, could you explain to me what is the purpose of "maxx" in job 1? Just to be allowed to find out "Earlier" later?

5 Replies

  • not clear about the expected output. Could you pls also provide the expected output in table?

      • omillan's avatar
        omillan
        New Member

        Thank you Ryan, this is amazing - you did that in 2 minutes and I have been working on it for 3 days.

        Here below the solution with 4 columns:

         

        job 1 = if( maxx(FILTER('Table','Table'[Id]=EARLIER('Table'[Id])-1),'Table'[Queue])='Table'[Queue],0,1)
        job2 = sumx(FILTER('Table','Table'[Id]<=EARLIER('Table'[Id])),'Table'[job 1])
        start = CALCULATE(min('Table'[Modified Date]),ALLEXCEPT('Table','Table'[job2]))
        end = CALCULATE(max('Table'[Modified Date]),ALLEXCEPT('Table','Table'[job2]))
         
        If possible, could you explain to me what is the purpose of "maxx" in job 1? Just to be allowed to find out "Earlier" later?
    • omillan's avatar
      omillan
      New Member

      Yes of course, I hope the below table is clearer.

       

      Basically anytime, "Queue" name changes that should mark a starting point for that "job". Likewise, it should take the last row before the "Queue" name changes as the end Point.  Expected columns are the last 3 columns:

      A) Job # - it should aggregate all queues (transactions) into groups = means, give them a unique reference number.

      B) Take the earliest date inside "Modified Date" for that specific Job and allocate it to all the rows in same Job #

      C) Same logic but now with the oldest date.

       

      PS: if tthose rows that have one single case and then change, are causing an issue. I already have a formula for that but it would be nice to have one single formula for all.

       

      IdQueueModified DateA - Job # B - Start Date C - Start Date
      1temp12/07/2023 05:36        112/07/2023 05:36   12/07/2023 05:36
      2Freightrates13/07/2023 00:06       213/07/2023 00:0613/07/2023 00:06
      3UserDisable_Deactivation13/07/2023 12:01   313/07/2023 12:0113/07/2023 12:01
      4ELDA_DataDownloads17/07/2023 19:01   417/07/2023 19:0117/07/2023 19:01
      5DangerousGoods_StandardArticles17/07/2023 20:10   517/07/2023 20:1017/07/2023 20:13
      6DangerousGoods_StandardArticles17/07/2023 20:11   517/07/2023 20:1017/07/2023 20:13
      7DangerousGoods_StandardArticles17/07/2023 20:11    517/07/2023 20:1017/07/2023 20:13
      8DangerousGoods_StandardArticles17/07/2023 20:11   517/07/2023 20:1017/07/2023 20:13
      9DangerousGoods_StandardArticles17/07/2023 20:12   517/07/2023 20:1017/07/2023 20:13
      10DangerousGoods_StandardArticles17/07/2023 20:12   517/07/2023 20:1017/07/2023 20:13
      11DangerousGoods_StandardArticles17/07/2023 20:12   517/07/2023 20:1017/07/2023 20:13
      12DangerousGoods_StandardArticles17/07/2023 20:13   517/07/2023 20:1017/07/2023 20:13
      13DangerousGoods_StandardArticles17/07/2023 20:13   517/07/2023 20:1017/07/2023 20:13
      14UserDisable_Deactivation13/07/2023 12:02   613/07/2023 12:0213/07/2023 12:02
      15Gradebewertung17/07/2023 20:36   717/07/2023 20:3617/07/2023 20:43
      16Gradebewertung17/07/2023 20:36   717/07/2023 20:3617/07/2023 20:43
      17Gradebewertung17/07/2023 20:37   717/07/2023 20:3617/07/2023 20:43
      18Gradebewertung17/07/2023 20:38   717/07/2023 20:3617/07/2023 20:43
      19Gradebewertung17/07/2023 20:39   717/07/2023 20:3617/07/2023 20:43
      20Gradebewertung17/07/2023 20:40   717/07/2023 20:3617/07/2023 20:43
      21Gradebewertung17/07/2023 20:40   717/07/2023 20:3617/07/2023 20:43
      22Gradebewertung17/07/2023 20:42   717/07/2023 20:3617/07/2023 20:43
      23Gradebewertung17/07/2023 20:43   717/07/2023 20:3617/07/2023 20:43
      24Creditreform_URLs17/07/2023 21:31   817/07/2023 21:3117/07/2023 21:31