Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
So here's the problem, I have two datasets, one has a lot of data, but with some outdated fields and the other has some specific columns with updated data. The nomber of columns is rather arbitrary, but they always have the same name. Due to the sensitivity of the data I'm going to post dummy data.
Assumptions:
Outdated table:
Table with new data:
What I expect as output:
What I am currently doing:
let
Source = OldData,
MergeWithNewData = Table.NestedJoin(Source, {"Date"}, NewData, {"Date"}, "NewData", JoinKind.LeftOuter),
ExpandNewData = Table.ExpandTableColumn(MergeWithNewData, "NewData", {"L1"}, {"NewData.L1"}),
AddNewColumn = Table.AddColumn(ExpandNewData, "New_L1", each if [NewData.L1] = null then [L1] else [NewData.L1], Int64.Type),
DeleteOldColumns = Table.RemoveColumns(AddNewColumn,{"L1", "NewData.L1"}),
RenameNewColumn = Table.RenameColumns(DeleteOldColumns,{{"New_L1", "L1"}})
in
RenameNewColumn
My problem is that this approach, although it works, can get REALLY messy when there's a lot of columns. So, is there a better way?
Thanks in advance
Solved! Go to Solution.
Hi @GermanAndres ,
According to your description, here's my solution. Add a step in advanced editor of the Outdated table:
#"Replace Value" = Table.ReplaceValue(#"Changed Type",each [L1], each try Table.SelectRows(#"Table",(x)=>x[Date]=[Date])[L1]{0} otherwise [L1], Replacer.ReplaceValue,{"L1"})
#"Table" in the formula is the table with new data. Get the correct result:
I attach my sample below for your reference.
Best regards,
Community Support Team_yanjiang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @GermanAndres ,
According to your description, here's my solution. Add a step in advanced editor of the Outdated table:
#"Replace Value" = Table.ReplaceValue(#"Changed Type",each [L1], each try Table.SelectRows(#"Table",(x)=>x[Date]=[Date])[L1]{0} otherwise [L1], Replacer.ReplaceValue,{"L1"})
#"Table" in the formula is the table with new data. Get the correct result:
I attach my sample below for your reference.
Best regards,
Community Support Team_yanjiang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This is a really clean solution, thank you!
Hi.
I believe you can use some of the list functions to solve this scenario. Something like:
Hope this help you!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
76 | |
73 | |
57 | |
38 | |
35 |
User | Count |
---|---|
83 | |
68 | |
59 | |
46 | |
45 |