Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Grouping in Power Query

Dear all,

Can anyone explain of how to group rows in Power Query based on whether all proper cells in column "Date" contain value or not.

Example with some more information below.

Thanks in advance,

Urmas

    1. Add an Index column
    2. Add a custom column with a formula similar to:  =if [Date] <> null then [Index] else null
      1. If the blank dates are not "null", you may need a different comparison:  eg [Date] <>""
    3. Fill down the custom column
    4. Group by {"Account no.","Entry number","Custom"}
    5. Then you can add a custom aggregation of a concatenated "Explanation"

4 Replies

  • So you want to remove the rows where [Entry number] starts with "TA" in this example?

    • Anonymous's avatar
      Anonymous
      Not applicable

      I would like to achieve following:

       

      Current situation:

      Entry noDateDescription
      TA 320.02.2017

      Ettemaks Algsaldo Maksude

      TA 3 

      ettemaksukonto (31.12.2016) Maksu- ja

      TA 3 

      Tolliamet

      Final situation:

      Entry noDateDescription
      TA 3 20.02.2017Ettemaks Algsaldo Maksude ettemaksukonto (31.12.2016) Maksu- ja Tolliamet

       

      In other words to merge rows with similar Entry no in order to have the description in one cell but only in cases where the date is missing in respective cells. If there is date in all respective cells it is different description and should not be merged.

       

      I hope it added some clarity.

       

      Regards,

       

      Urmas

      • ronrsnfld's avatar
        ronrsnfld
        Icon for Super User rankSuper User
        1. Add an Index column
        2. Add a custom column with a formula similar to:  =if [Date] <> null then [Index] else null
          1. If the blank dates are not "null", you may need a different comparison:  eg [Date] <>""
        3. Fill down the custom column
        4. Group by {"Account no.","Entry number","Custom"}
        5. Then you can add a custom aggregation of a concatenated "Explanation"
  • Anonymous's avatar
    Anonymous
    Not applicable

    Thank you. Solution works perfectly:

    Regards,

     

    Urmas