Forum Discussion

techlog's avatar
techlog
Frequent Visitor
2 years ago
Solved

Multiple rows into one based on similar column values

Hi,  Is there any way we can display multiple rows having similar column values into single row till the columns which have duplicate/same value.   Example below -     
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi techlog ,

    Based on my testing, please try the following methods:

    1.Create the sample table.

    2.Create the new index column.

    3.Create the new measure to display multiple ID rows into single row.

    Multiple ID = 
    var _index = SELECTEDVALUE('Table'[Index])
    VAR _id = SELECTEDVALUE('Table'[Emp ID])
    RETURN
    IF(CALCULATE(SELECTEDVALUE('Table'[Emp ID]),FILTER(ALL('Table'),'Table'[Index] = _index-1)) = _id,BLANK(),_id)

    4.Create the new measure for each column that have multiple rows.

    Multi Name = 
    var _index = SELECTEDVALUE('Table'[Index])
    VAR _name = SELECTEDVALUE('Table'[Name])
    RETURN
    IF(CALCULATE(SELECTEDVALUE('Table'[Name]),FILTER(ALL('Table'),'Table'[Index] = _index-1)) = _name,BLANK(),_name)
    Multiple category = 
    var _index = SELECTEDVALUE('Table'[Index])
    VAR _cat = SELECTEDVALUE('Table'[Category])
    RETURN
    IF(CALCULATE(SELECTEDVALUE('Table'[Category]),FILTER(ALL('Table'),'Table'[Index] = _index-1)) = _cat,BLANK(), _cat)

    5.Drag the measure into the table.

    6.The result is shown below.

     

    Best Regards,

    Wisdom Wu

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