Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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!
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
110 | |
102 | |
99 | |
38 | |
37 |
User | Count |
---|---|
158 | |
125 | |
76 | |
74 | |
63 |