Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Flag column for first instance

I need to create a column that returns a 0 or a 1 based on the first instance. Could someone help me?

 

MachineWork OrderMaterialBatchProduction DayMachine ScrapGood Qty
xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM33103734164
xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM33103734164
xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM33103734164
xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM33103734164
xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM33103734164
xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM29452744589
xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM29452744589
xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM29452744589
xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM29452744589
xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM29452744589
xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM31577819528
xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM31577819528
xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM31577819528
xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM31577819528
xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM31577819528
xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM37337422891
xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM37337422891
xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM37337422891
xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM37337422891
xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM37337422891
xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM22584814593
xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM22584814593
xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM22584814593
xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM22584814593
xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM22584814593
xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM27079981785
xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM27079981785
xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM27079981785
xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM27079981785
xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM27079981785

6 Replies

  • NaveenGandhi's avatar
    NaveenGandhi
    Memorable Member

    Hello Anonymous 

    Your question is very unclear, Can you explain it a bit elaborate and also provide the desired output for the above sample data.

     

    Regards,

    Naveen

    • Anonymous's avatar
      Anonymous
      Not applicable

      This is what I would like it to do.

       

      MachineWork OrderMaterialBatchProduction DayMachine ScrapGood QtyFirst Instance
      xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM331037341641
      xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM331037341640
      xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM331037341640
      xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM331037341640
      xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM331037341640
      xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM294527445891
      xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM294527445890
      xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM294527445890
      xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM294527445890
      xxxxxxxxxxxxxxxx06/01/2023 12:00:00 AM294527445890
      xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM315778195281
      xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM315778195280
      xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM315778195280
      xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM315778195280
      xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM315778195280
      xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM373374228911
      xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM373374228910
      xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM373374228910
      xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM373374228910
      xxxxxxxxxxxxxxxx06/02/2023 12:00:00 AM373374228910
      xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM225848145931
      xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM225848145930
      xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM225848145930
      xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM225848145930
      xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM225848145930
      xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM270799817851
      xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM270799817850
      xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM270799817850
      xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM270799817850
      xxxxxxxxxxxxxxxx06/03/2023 12:00:00 AM270799817850
      • Ashish_Mathur's avatar
        Ashish_Mathur
        Super User

        Hi,

        Even before we inser the First instance column, on what criteria should the data be sorted?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous ,

     

    Here are the steps you can follow:

    1. In Power Query -- Add Column – Index Column – From 1.

    2. Create calculated column.

    First Instance =
    IF(
        [Index]=
    MINX(
        FILTER(ALL('Table'),'Table'[Good Qty]=EARLIER('Table'[Good Qty])),[Index]),1,0)

    3. Result:

     

    Best Regards,

    Liu Yang

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