Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Hi there!
I have 1st table here with some incorrect data and would like to replace it based on the 2nd table.
The value in red font is wrong, the correct data is in 2nd table.
I would like to change the waterusage.value for ID 21345 at year 2021 to 50, instead of 12000 in table 1. Similar to waterusage.value of ID 9281 at year 2021, change to 300 instead of 40000.
I tried to use table.replacevalue(#"Added Custom", each [waterusage.value], each if Table2{[waterusage.value] = value then Table2[waterusage.value], Replacer.ReplaceText,{"waterusage.value"})
But I notice it is not feasible because there might be addtional columns in table 2, such as if we found more incorrect data in table 1, we will need to add new column in table 2 like energyusage.value, wastedisposal.value. Is there any way if we not hard code the column name and the code will directly take table 2 value if it found the column there?
Thank you
Solved! Go to Solution.
suppose the bound value of year and ID in table 2 is unique, you can try this code.
NewStep in Table1=Table.FromRecords(Table.TransformRows(Table1,each _&(Table2{[Year=[Year],ID=[ID]]}? ??[])))
yes, they are unique. and the code works well! thank you!
suppose the bound value of year and ID in table 2 is unique, you can try this code.
NewStep in Table1=Table.FromRecords(Table.TransformRows(Table1,each _&(Table2{[Year=[Year],ID=[ID]]}? ??[])))
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
63 | |
56 | |
27 | |
17 | |
13 |