Forum Discussion

chq's avatar
chq
Helper II
6 years ago
Solved

Grouping by Column Contains?

My data looks somethng like this...

Transaction #Type CodeType(Desired Column)
121000LongLong Term
12101TheatreLong Term
121900BaseballLong Term
99104TheatreLong Term
991001Long 1Long Term
61104TheatreTheatre



Is there a way to Group where the transaction number for all rows of the column has a subcategory based on the Type to get the desired column shown above? Meaning If the Type contains Long then all Transaction #s that have a row with Long the new column categorizes that Transaction number for all rows as Long Term

6 Replies

  • chq , create a new column like

    New column =
    var _1 = countX(filter(table,[Transaction #]=earlier([Transaction #]) && [Type]="Type"),[Transaction #])
    return
    if(isblank(_1) || _1 =0,[Type],"Long Term")

    • chq's avatar
      chq
      Helper II

      @amitchandak  Would this be able to apply to multiple types, for example if it doesn't contain Long or Baseball but does contain Theatre then it equals Theatre?

    • amitchandak's avatar
      amitchandak
      Super User

      I have Taken count of long , you have one more countx and create logic

      or use in

      [Type]="Long"

      [Type]="Basketball"

       

      or

      [Type] in{"Long","Basketball"}

      • chq's avatar
        chq
        Helper II

        amitchandak I am not sure I understand can you give me an example formula with that logic also applied? Thanks