Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
smitpau
Helper I
Helper I

Power M - Cyclic Reference encountered during evaluation

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.

1 ACCEPTED 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}})

 

Refresh breaks due to COLUMN NAME CHANGES? 3 ways to fix changing column headers in Power BI! - YouT...

View solution in original post

4 REPLIES 4
tex628
Community Champion
Community Champion

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


Connect on LinkedIn
tex628
Community Champion
Community Champion

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





Connect on LinkedIn

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}})

 

Refresh breaks due to COLUMN NAME CHANGES? 3 ways to fix changing column headers in Power BI! - YouT...

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}}

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.