Forum Discussion

merijndk's avatar
merijndk
New Member
9 years ago
Solved

Power Bi create comma seperated list string where ids match

Im really new to Power Bi, I created the following table: ID | POST_ID | 0 | 11 | 0 | 12 | 0 | 13 | 0 | 18 | 0 | 21 | 1 | 14 | 1 | 15 | 2 | 16 | 2 | ...
  • lalthan's avatar
    9 years ago

    Assuming your existing table name is "Concat" and the new table to be created  is "Grouped", In data view, click on new table and paste the following:

     

    Grouped = calculatetable(
    addcolumns(
    summarize(
    ConCat
    ,ConCat[ID ]
    )
    ,"Post IDs",calculate(CONCATENATEX(ConCat,[ POST_ID ],","))
    )
    )

  • Anonymous's avatar
    Anonymous
    9 years ago

    Hi 

     

      You can create few columns and can hide them in the report.

     

    Replace Table1 with your table name.

     

    Rnk = RANKX ( FILTER ( All ( Table1 ), Table1[ID] = EARLIER ( Table1[ID] ) ), Table1[Post_ID], , 1, DENSE )

     

    ParRnk = IF (Table1[Rnk] <> 1, Table1[Rnk]-1)


    ParPost= CALCULATE ( FIRSTNONBLANK ( Table1[Post_ID], 1 ), FILTER ( ALLEXCEPT ( Table1, Table1[ID] ), Table1[Rnk] = EARLIER ( Table1[ParRnk] ) ) )


    Concat = SUBSTITUTE(CALCULATE ( PATH ( Table1[Post_ID], Table1[ParPost] ), CALCULATETABLE ( FILTER ( Table1, Table1[Rnk] = Max ( Table1[Rnk] ) ), ALLEXCEPT ( Table1, Table1[ID] ) ) ) ,"|",",")

     

     

    Thanks

    Hari