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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Chas2002
Helper III
Helper III

Advanced Query Parameter Expression.Error

Hi Everyone,

 

I have a large db so I need to limit the initial load.  I researched and found paramaters and advanced queries, which I'm testing with a simple Start Date and End Date input.

 

My setup:

Source Database is callrecord, table is callrecord, sys_date is Date Type

 

1. Have a start_date paramater, Date Type

2. Have an end-date paramater, Date Type,

3. Have the below Advanced query in place, it passes with no syntax errors, but when I select done I get: "Expression.Error: A cyclic reference was encountered during evaluation."

 

What am I doing wrong?

 

The query:

 

let
    Source = Odbc.DataSource("database=Z:\IntelDriven\db\callrecord.db;dsn=SQLite3 Datasource", "SELECT * FROM CallRecord WHERE sys_date => ('" & Start_Date & "') AND sys_date =< ('" & End_Date & "')")
    
in
    CallRecord

The image:

 

 

AdvancedQuery.jpg

 

Thanks,

Chas

6 REPLIES 6
ianca42
New Member

Hi Chas,

 

this look like a simply fix.

 

Try:

let
    Source = Odbc.DataSource("database=Z:\IntelDriven\db\callrecord.db;dsn=SQLite3 Datasource", "SELECT * FROM CallRecord WHERE sys_date => ('" & Start_Date & "') AND sys_date =< ('" & End_Date & "')")
    
in
    Source

 

ianca42 - Thanks for your help, but still getting error: "Expression.Error: A cyclic reference was encountered during evaluation."

 

Chas

Let me explain further.

 

Looking at the Image I see that the Query in question is named CallRecord. When you write CallRecord in any other Query inside the PBIX it will call it. If you change the reference from "in CallRecord" to "in Source", it should work.

Yes, I removed CallRecord and replaced it with Source.  Still getting the cyclic error...

Hi @Chas2002,

 

Seems the parameters from Power BI can't be added in the SQL statements. Please vote up this idea.

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Voted.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.