Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Append in DAX

Is there a simple way i can append two tables via creating a new table in DAX. I dont want to do the append in Query editor. Is there a way of doing that in the the front end of the report with New Table. I can't use UNION as the column names dont match

  • You can union them after getting the column names matched up with SELECTCOLUMNS.

     

    For example,

    Appended =
    UNION (
        SELECTCOLUMNS ( Table1, "A", Table1[Col1], "B", Table1[Col2] ),
        SELECTCOLUMNS ( Table2, "A", Table2[aCol], "B", Table2[bCol] )
    )

    This will return a table with columns [A] and [B] even though Table1 and Table2 did not have such column names.

1 Reply

  • You can union them after getting the column names matched up with SELECTCOLUMNS.

     

    For example,

    Appended =
    UNION (
        SELECTCOLUMNS ( Table1, "A", Table1[Col1], "B", Table1[Col2] ),
        SELECTCOLUMNS ( Table2, "A", Table2[aCol], "B", Table2[bCol] )
    )

    This will return a table with columns [A] and [B] even though Table1 and Table2 did not have such column names.