Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Possible to copy a large table changing only one element?

I am creating a pretty large report that pulls similar data from multiple sources. I have worked out a table that has dozens of coumns, each with a lot of DAX of varying sophistication. I need to cre...
  • Anonymous's avatar
    Anonymous
    5 years ago

    HI Anonymous,

    I also think union functions with selectcolumns show suitable for your scenarios.
    You can use them to selectcolumns to pick up the table and change some of the value of their fields or add expression to calculate, the union function will merge them as a new table. You can write DAX expression on it instead of duplicate these formulas on each table.

    New Table =
    UNION (
        SELECTCOLUMNS (
            Table1,
            "ID", [ID],
            "Date", [Create],
            "Price", [Price],
            "Amount", [Sales]
        ),
        SELECTCOLUMNS (
            Table2,
            "ID", [ID],
            "Date", [DateIn],
            "Price", [Price],
            "Amount", [Qty]
        ),
        SELECTCOLUMNS (
            Table3,
            "ID", [ID],
            "Date", [Finish],
            "Price", [Price],
            "Amount", [Value]
        )
    )
    

    Reference links of Dax functions:

    SELECTCOLUMNS 

    UNION 

    BTW, you can also add filters nested into selectcolumns table expressions to filter records if there existed some of the records you not want them to show into the merged new table.

    Regards,

    Xiaoxin Sheng