Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi there!
I have table 1 here with some incorrect data and would like to replace it based on the table 2.
The value in red font is wrong, the correct data is in 2nd table.
with the code below, I manage to replace the red wrong value in Table 1 with Table 2:
Table.FromRecords(Table.TransformRows(#"Table1",each _&(Table2{[year=[year],id=[id]]}? ??[])))
However, is it possible if can only replace those not null (exclude the grey cells in Table 2)? In table 1, row 3, energyusage.value of 600 is correct, so it is null in table 2 (grey cell), no need to replace null to table 1. How do with only replace the value in Table 2 to Table 1 if it contains a value, not replace if Table 2 is empty?
Thank you
Solved! Go to Solution.
= Table.FromRecords(Table.TransformRows(Table1,each let a=Table2{[Year=[Year],ID=[ID]]}? in if a is null then _ else Record.TransformFields(_,Table.ToList(Table.SelectRows(Record.ToTable(a),each [Value]<>null and [Value]<>""),each {_{0},(x)=>_{1}}),1)))
works well which null is not replacing the value! thank you!
= Table.FromRecords(Table.TransformRows(Table1,each let a=Table2{[Year=[Year],ID=[ID]]}? in if a is null then _ else Record.TransformFields(_,Table.ToList(Table.SelectRows(Record.ToTable(a),each [Value]<>null and [Value]<>""),each {_{0},(x)=>_{1}}),1)))
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 |
---|---|
71 | |
56 | |
43 | |
28 | |
22 |