Forum Discussion

Saxon10's avatar
Saxon10
Post Prodigy
4 years ago
Solved

How can I convert multiple tables into one table by using DAX code.

  I have 4 tables are Table1,2,3 and table4 and it’s contain the following columns are id, result, filter and city code. The tables headers are same but the data is different.   How can I get all ...
  • lbendlin's avatar
    lbendlin
    4 years ago

    jeroendekk you can do that with ADDCOLUMNS().

     

    Personally I would apply the filter earlier, but it may not matter.

     

    Combined Table = UNION (
    ADDCOLUMNS(FILTER(Table1,[Filter]="No"),"Table Reference","Table1"),
    ADDCOLUMNS(FILTER(Table2,[Filter]="No"),"Table Reference","Table2"),
    ADDCOLUMNS(FILTER(Table3,[Filter]="No"),"Table Reference","Table3"),
    ADDCOLUMNS(FILTER(Table4,[Filter]="No"),"Table Reference","Table4")
    )