Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Is there a way to dynamically filter a Snowflake custom SQL statement by using parameters via URL input?
I am building Power BI report with the below requirements. The query works if I remove the last filters for parameters. However, I cannot bring in the entire dataset and need to be able to dynamically filter the query based upon the 2 parameters. The issues and current state details are below below. Please help.
Issues:
Requirements:
Current State:
Custom SQL query:
WITH cte_rpt_audit_v AS (
.... joins and aliases...
)
SELECT *
FROM cte_rpt_audit_v
WHERE entity_table = ‘{{par_entity_table}}’
AND object_id = ‘{{par_object_id}}’
Advanced Editor for Snowflake table:
Parameter Settings:
Hi @Jbigby
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
Hi @Jbigby ,
Thanks for reaching out to the Microsoft fabric community forum.
For a DirectQuery model table, the query must be a SELECT statement, and it can't use Common Table Expressions (CTEs) or a stored procedure.
Source: Query folding guidance in Power BI Desktop - Power BI | Microsoft Learn
This might be the reason for the error you are facing.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thank you
Hi @v-nmadadi-msft - I've removed the CTEs and just used a standard SELECT statement. I am still not seeing results in the report. I also tried the URL and no results were returned.
Hi @Jbigby ,
Most likely the root cause of thee error is your query is not getting folded down and isn’t reaching the source database with the correct query.
Please follow this article and try to test query folding and troubleshoot it:
Query folding on native queries - Power Query | Microsoft Learn
Also the and operator is not supported in dynamic M query operations
Source: Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn
If this post helps, then please consider Accepting as solution to help the other members find it more quickly and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thank you
Hi @v-nmadadi-msft ,
The issue still isn't resolved. I've removed the CTE. Query folding is enabled with custom query. I do not see the option to bind the parameter.
I had a call earlier with Microsoft and was sent a link for free consulting with OmniData Insights. I will set up time to work with them.
Hi @Jbigby ,
We really appreciate your efforts and for letting us know the update on the issue.
Please keep us posted with any resolution that you may reach with them.
Additionally continue using fabric community forum for your further assistance.
Thank you
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
13 | |
13 | |
10 | |
8 | |
7 |
User | Count |
---|---|
17 | |
10 | |
7 | |
7 | |
6 |