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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
sedkimic
Frequent Visitor

Recursive Functions in online versions of Power Query

I have a recursive power query custom function that works as expected in Power BI desktop.  When I try to use the same M code as part of creating a dataflow or datamart I receive an error message stating "Expression.Error: A cyclic reference was encountered during evaluation."  Are recursive functions not supported in the online versions of power query?

 

For reference the function is below where date is a scalar date value and holidays is a list of dates.

******************************************

let
    Source = (date as date,holidays as list) =>
   
    let
    adjusted_date =
   
        if Date.DayOfWeek(date)=0
        then Date.AddDays(date,1)
        else if Date.DayOfWeek(date)=5 then Date.AddDays(date,3)
        else if Date.DayOfWeek(date)=6 then Date.AddDays(date,2)
        else Date.AddDays(date,1)
    ,
   
holiday_adjusted=
    if List.Contains(holidays,adjusted_date) then @liquidity_date(adjusted_date,holidays)
    else adjusted_date
in  
    holiday_adjusted
in
    Source

 

 

 

1 ACCEPTED SOLUTION
artemus
Microsoft Employee
Microsoft Employee

This appears to be mostly a visual bug, you can still invoke the function as normal. You can also wrap it in a 

let liquidity_date_fn = <code> in liquidity_date_fn

and just use @liquidity_date_fn when you call the function

View solution in original post

2 REPLIES 2
artemus
Microsoft Employee
Microsoft Employee

This appears to be mostly a visual bug, you can still invoke the function as normal. You can also wrap it in a 

let liquidity_date_fn = <code> in liquidity_date_fn

and just use @liquidity_date_fn when you call the function

This works.  Thank you.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Solution Authors
Top Kudoed Authors