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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
vojtechsima
Super User
Super User

Inner function call cannot be saved in Power BI Dataflow

Hello, guys,

I have this function 

 

 

let
     ExpandIt = (TableToExpand as table, optional ColumnName as text) =>
     let
          ListAllColumns = Table.ColumnNames(TableToExpand),
          ColumnsTotal = Table.ColumnCount(TableToExpand),
          CurrentColumnIndex = if (ColumnName = null) then 0 else  List.PositionOf(ListAllColumns, ColumnName),
          CurrentColumnName = ListAllColumns{CurrentColumnIndex},
          CurrentColumnContent = Table.Column(TableToExpand, CurrentColumnName),
          IsExpandable = if List.IsEmpty(List.Distinct(List.Select(CurrentColumnContent, each _ is record))) then false else true,
          FieldsToExpand = if IsExpandable  then Record.FieldNames(List.First(List.Select(CurrentColumnContent, each _ is record))) else {},
          ColumnNewNames = List.Transform(FieldsToExpand, each  CurrentColumnName &"."& _),
          ExpandedTable = if IsExpandable  then Table.ExpandRecordColumn(TableToExpand, CurrentColumnName, FieldsToExpand, ColumnNewNames) else TableToExpand,
          NextColumnIndex = CurrentColumnIndex+1,
          NextColumnName = ListAllColumns{NextColumnIndex},
          OutputTable = if NextColumnIndex > ColumnsTotal-1 then ExpandedTable else _ExpandIt(ExpandedTable, NextColumnName)
     in
          OutputTable
in
     ExpandIt

 

 


For certain recent reasons I need to use PBI Dataflow, the connector is On-Premise Gateway.
This Function is it's own query, when I call this function in another query it works perfectly. However, this dataflow cannot be saved because I get this error:

vojtechsima_0-1667749612929.png

The cycle is caused by function calling itself, however, that shouldn't be a problem since, the calling in my fact table works and this whole thing works also in Power BI DEsktop PQ.

The flow is "enhanced mode" in Power BI Premium capacity workspace.

I appretiate andy comment.

 
 
 





Any kudos or recognition appreciated. To learn more on the topic, check out my blog and follow me on LinkedIn.
1 ACCEPTED SOLUTION
vojtechsima
Super User
Super User

So, I fixed it by nesting the function inside my actual query, but... This is some weird behavior that only gives a headache, please could someone from Microsoft admins advise me on this, if this is a bug or a "feature", please?
Then we can consider this thing "Solved".

 
 





Any kudos or recognition appreciated. To learn more on the topic, check out my blog and follow me on LinkedIn.

View solution in original post

2 REPLIES 2
vojtechsima
Super User
Super User

So, I fixed it by nesting the function inside my actual query, but... This is some weird behavior that only gives a headache, please could someone from Microsoft admins advise me on this, if this is a bug or a "feature", please?
Then we can consider this thing "Solved".

 
 





Any kudos or recognition appreciated. To learn more on the topic, check out my blog and follow me on LinkedIn.

Hi @vojtechsima 

Thanks for reaching out to us.

please check if these links help

Exception using Parameter in Power Query: A cyclic... - Microsoft Power BI Community

Cyclic reference in Power Query - How to avoid? - Microsoft Community Hub

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.