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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Christianvs
Helper II
Helper II

Dynamic SQL for a template

Hi

 

I have a template for a report where I have the following issue:

 

The report consist of several queries that all depend on the same variables being present ind the database, i.e.

SELECT ...

FROM ...

WHERE VAR1 = A AND VAR2 = B

 

Every time I make a new report using the template I have to go into every single query and change VAR1 = A and VAR2 = B. Is it instead possible to set A and B to a value from outside the query? Maybe by making a simple table where i set REF1 = A and REF2 = B and then reference this from within the queries with VAR1 = table[REF1] and VAR2 = table[REF2]? In that way i would only have to change the table reference whenever I make a new version from the template.

 

Thanks

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User
2 REPLIES 2
amitchandak
Super User
Super User

Thanks for the answer amitchandak!

This seems to be just the thing I was looking for

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

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.