Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Daryl_K
Resolver II
Resolver II

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 create a few dozen more tables that are identical but one set changes one particular (recurring) variable in the DAX (i.e. AAA replaced with BBB, while leaving everythin else unchanged), and another set changes a different variable, etc.

 

Is this possible? There is so much DAX I developed but doesn't change (outside the one variable in each) that even copying and pasting one column at a time takes forever. The ability to export a table, search and replace All on one element, then re-import it as a different table would be great.

 

Is there a way to do this using Excel or similar?

1 ACCEPTED SOLUTION

HI @Daryl_K,

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Daryl_K , union with summarize and SELECTCOLUMNS  , there you can change the value , In summarize keep that column at last

Table = union(
SELECTCOLUMNS(Instagram, "Index",[Index], "row",[Row])
,SELECTCOLUMNS(Instagram, "Index",[Index], "row",1)
)

 

 

also refer: https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/

I am not entirely sure I am understanding your suggestion, but it could just be my limited Power BI experience.

Let's say for example I have a table with one column, and the column has the DAX shown below, but I want to replace every instance of REV (irrespective of where it falls in the expression) with RFV.

What would the UNION look like?

 

G1 =
CALCULATE(
SUM('Causals'[Quantity]),
FILTER('Causals', 'Causals'[Test Month] = 'Level 1 REV'[Month] && 'Causals'[Test Year] = 'Level 1 REV'[Calendar Year] && 'Causals'[Site] = "REV" && 'Causals'[Causal Lvl 1] = "G1"))

 

HI @Daryl_K,

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.