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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.