Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I'm trying to replace values based on the column indexed position using Table.ColumnNames.
If I try the code below replacing the actual column name with the Table.ColumnNames version for some reason there is a cyclice reference error.
= Table.ReplaceValue(#"Removed Columns",null,"0",Replacer.ReplaceValue,{Table.ColumnNames(#"GPL adjustments"){4}, Table.ColumnName(#"GPL adjustments"){5}})
Any help is appreciated.
Thanks for reading.
Solved! Go to Solution.
Thanks.
Think you were right the issue was the source was not correct.
I followed the video below, checked the syntax of the code for example below and it works.
Table.ReplaceValue(#"Removed Columns",null,"0",Replacer.ReplaceValue,{Table.ColumnNames(#"Removed Columns"){3}, Table.ColumnNames(#"Removed Columns"){4}, Table.ColumnNames(#"Removed Columns"){5}})
Sorry, it doesn't appear to be as easy as i thought. I cant seem to figure out how to reference earlier steps in other queries.
Essentially you can't reference the final step in GPL Adjustments because something in those queries is dependant on the querie you want to transform.
What i wanted to do is reference the GPL queries before they become dependant but I think i need some more time to see how you reference correctly.
Another solution that isn't as nice is breaking up the GPL queries before they become dependant by creating a new reference query just before you do the dependant transformation.
Then you can turn off the load of the original queries, and then reference them in the replace transform without any errors.
/ J
You need to replace the table references with tables that occur before the transformation. Like this:
= Table.ReplaceValue(#"Removed Columns",null,"0",Replacer.ReplaceValue,Table.ColumnNames(#"Removed Columns")
If you want to reference GPL Adjustments 4 and 5 you need to make sure you reference them at a step where your current table has not affected the transformation stages yet.
Br,
J
Thanks.
Think you were right the issue was the source was not correct.
I followed the video below, checked the syntax of the code for example below and it works.
Table.ReplaceValue(#"Removed Columns",null,"0",Replacer.ReplaceValue,{Table.ColumnNames(#"Removed Columns"){3}, Table.ColumnNames(#"Removed Columns"){4}, Table.ColumnNames(#"Removed Columns"){5}})
Ah okay I think I see so it has to flow from the last transformation.
So it would be like
{Table.ColumnNames(#"Removed Columns"){4}, Table.ColumnName(#"Removed Columns"){5}}
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
96 | |
77 | |
63 | |
55 |
User | Count |
---|---|
143 | |
109 | |
89 | |
84 | |
66 |