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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Christianvs
Helper I
Helper I

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
2 REPLIES 2

Thanks for the answer amitchandak!

This seems to be just the thing I was looking for

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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