Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
Hi,
I have loaded a table of SQL definitions.
Sample record:
| schema_name | view_name | view_definition |
| powerbi | view_fact_program_registration | SELECT p.club_key, p.location_key, p.service_key, p.program_session_key, p.durable_user_key, p.row_is_archived, p.is_unregistered FROM (fact_program_registration p JOIN dim_program_session dp ON ((p.program_session_key = dp.program_session_key))) WHERE (1 = 1); |
On the dashboard, I would like to display the definition in proper SQL format:
SELECT p.club_key,
p.location_key,
p.service_key,
p.program_session_key,
p.durable_user_key,
p.row_is_archived,
p.is_unregistered
FROM fact_program_registration p
JOIN dim_program_session dp ON p.program_session_key = dp.program_session_key
WHERE 1 = 1;
Anyone know of a way to do this? (I'm thinking I may need to create a PowerQuery function?)
Thanks in advance 🙂 Joy
Solved! Go to Solution.
Hi @joyhackett,
AFAIK, current power bi does not support formatting T-SQL strings.
In my opinion, I'd like to suggest your enter 'query editor' to add a custom column to invoke the T-SQL string formatting API that processes and store a formatted string into this custom column.
Regards,
Xiaoxin Sheng
Dear all,
I do have exactely the same issue, but for me in a fabric notebook. I want to document the query in a notebook. Unfortunately the formatting is still like the first screenshot of @joyhackett . Any idea how I can format it in a better way?
Happy about Input 🙂
At the moment I use this:
sql_file_path = 'abfss://xxxx@onelake.dfs.fabric.microsoft.com/xxxx.Lakehouse/Files/silver/views/purchasetransactions.sql'
Hi @joyhackett ,
In DAX you can create a calculated column as follows :
I tried a solution using power query but it did not work in the report view.
Kind regards,
Rohit
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂
Thank you.
Your solution will only work for the sample row that I provided. There are 100 rows of SQL view definitions.
However, I see what you are doing with the line breaks, so this puts me on a possible path.
Hi @joyhackett,
AFAIK, current power bi does not support formatting T-SQL strings.
In my opinion, I'd like to suggest your enter 'query editor' to add a custom column to invoke the T-SQL string formatting API that processes and store a formatted string into this custom column.
Regards,
Xiaoxin Sheng
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 23 | |
| 23 | |
| 20 | |
| 18 | |
| 14 |
| User | Count |
|---|---|
| 58 | |
| 51 | |
| 40 | |
| 30 | |
| 24 |