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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
GeorgianL
New Member

Add endscript syntax in Power BI generated script

Hello, 

 

I'm trying to find a solution to add a comment at the end of each script generated by Power BI(script sent in Snowflake) with some details - like username, name of the report etc. 

 

Does anyone know how I can achieve something like this ? 

 

In SAP Business Objects we have the End SQL option (for those familiar with SAP BO)

 

 

Thank you!

Georgian 

4 REPLIES 4
v-saisrao-msft
Community Support
Community Support

Hi @GeorgianL,

Have you had a chance to review the solution we shared by @rohit1991? If the issue persists, feel free to reply so we can help further.

 

Thank you.

Hello,   not yet 

 

Thank you, @rohit1991  

Hi @GeorgianL,

Currently, Power BI does not support this functionality. Unlike SAP BO’s End SQL, Power BI does not have an option to automatically add a comment or script to every query sent to the source.

If you would like a similar feature in Power BI, you can suggest it in the Fabric Ideas forum for the product team to review. If it receives enough support, Microsoft may consider adding it in the future.

Fabric Ideas - Microsoft Fabric Community

 

Thank you.

rohit1991
Super User
Super User

Hi @GeorgianL 

Power BI can’t append an “end script” comment to the SQL it generates, so you can’t get a BO-style -- comment at the end of every query.

What you can do (and what most Snowflake shops use) is QUERY_TAG:

  • Set a tag for the session (e.g., ALTER SESSION SET QUERY_TAG='Report=Sales, Owner=Georgian';) so every query carries that metadata in Snowflake.

  • You can run that as an init/connection SQL or pass it via the connector’s advanced/connection settings (static or via a Power Query parameter).

  • Then read it in QUERY_HISTORY to see which report/user ran what.

If you truly need literal comments in the SQL text, that would require a custom connector/driver or proxy layer Power BI doesn’t expose a hook for modifying its generated SQL.


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.