Forum Discussion

answeriver's avatar
answeriver
Helper IV
6 years ago
Solved

Reorder columns

Hello,

Can't understand, i need UNION in DAX 3 tables in 1. In query i made reodrder columns, but when i load data to power bi, place of column not change. I dont understand why.

Here is screen shotю

  • Hi answeriver ,

     

    If you use SELECTCOLUMNS function to specific the location of column name like DAX formula1 below, then the result table will return the corresponding location display. Otherwise, if you use formula2 which the three tables have the same data structure, the returned column location will be the same with the original tables. Or you may use Append feature in Query Editor to combine three tables which have the same data structure into one.

     

    formula1= UNION(
    SELECTCOLUMNS('Table1',"Name1",[Description],"Name2",[Amount]),
    SELECTCOLUMNS('Table2',"Name1",[Description],"Name2",[Amount]),
    SELECTCOLUMNS('Table3',"Name1",[Description],"Name2",[Amount]))
     
    formula2= UNION(Table1,Table2,Table3)

    If I misunderstood it, could you please show your DAX formula for further analysis?

     

    Best Regards,

    Amy

     

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

     

3 Replies

  • Nathaniel_C's avatar
    Nathaniel_C
    Community Champion

    answeriver ,

    Not sure if this is the answer, but try hitting the refresh button.

     

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
    Nathaniel

  • v-xicai's avatar
    v-xicai
    Community Support

    Hi answeriver ,

     

    If you use SELECTCOLUMNS function to specific the location of column name like DAX formula1 below, then the result table will return the corresponding location display. Otherwise, if you use formula2 which the three tables have the same data structure, the returned column location will be the same with the original tables. Or you may use Append feature in Query Editor to combine three tables which have the same data structure into one.

     

    formula1= UNION(
    SELECTCOLUMNS('Table1',"Name1",[Description],"Name2",[Amount]),
    SELECTCOLUMNS('Table2',"Name1",[Description],"Name2",[Amount]),
    SELECTCOLUMNS('Table3',"Name1",[Description],"Name2",[Amount]))
     
    formula2= UNION(Table1,Table2,Table3)

    If I misunderstood it, could you please show your DAX formula for further analysis?

     

    Best Regards,

    Amy

     

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