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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Mahi1827
Resolver I
Resolver I

Need help on how to add values from first table and replace with current value in second table

I have scenario like below.
I have two tables results as below

Table 1
--------
Channel customer  viewcount
A1           C1            2500


Table 2
--------
Channel customer viewcount
B1          C2            4500
B1          C3            5500


Here i need to summarize two tables and replacing A1 with B1, here Table 2 results always same and need to add exsiting table 1 results to table 2 by replacing by table 2 channel.

expected output like below

 

Channel  Customer   Viewcount
B1            C1             2500 ( this record from channel A1 from Table 1)
B1            C2             4500
B1            C3             5500

 

I have tried with Append and Union but dynamically i am unable to find the solution.

Please look into this and suggest me with DAX approach.

 

Thank you for your time and help in advance.

Thanks,
Mahi18

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Mahi1827 ,

 

You could try to write a DAX expression to create a new table.

NewTable = 
VAR t1 =
    SELECTCOLUMNS (
        'Table 1',
        "Channel", SUBSTITUTE ( 'Table 1'[Channel], "A1", "B1" ),
        "customer", 'Table 1'[customer],
        "viewcount", 'Table 1'[viewcount]
    )
RETURN
    UNION ( t1, 'Table 2' )

6.png

 

 

You can check more details from here.

 

 

Best Regards,

Stephen Tao

 

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Mahi1827 ,

 

You could try to write a DAX expression to create a new table.

NewTable = 
VAR t1 =
    SELECTCOLUMNS (
        'Table 1',
        "Channel", SUBSTITUTE ( 'Table 1'[Channel], "A1", "B1" ),
        "customer", 'Table 1'[customer],
        "viewcount", 'Table 1'[viewcount]
    )
RETURN
    UNION ( t1, 'Table 2' )

6.png

 

 

You can check more details from here.

 

 

Best Regards,

Stephen Tao

 

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

amitchandak
Super User
Super User

@Mahi1827 , Use replace in transform data/power Query . Right-click on column there is option

https://www.howtoexcel.org/power-query/bulk-replace-values/

 

Then merge the two data

https://radacad.com/append-vs-merge-in-power-bi-and-power-query

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Greg_Deckler
Community Champion
Community Champion

@Mahi1827  Well, there is a SUBSTITUTE function and a REPLACE function in DAX but I am not understanding the logic here. I suppose there might be a DAX solution, but wouldn't it be easier to just right-click the column header in Power Query and Replace "A1" with "B1" ?

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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