Forum Discussion
Power BI Documentation
Thanks to Microsoft for providing the View Functions feature — it’s really useful.
Similarly, is there a way to automatically capture data source details such as the connected server and the queries used? I’d like to store all this information in a table for easy reference.
Hi Vivek_BI
There isn’t currently a built-in feature in Power BI that automatically documents all data source details (server name, database, query text) into a table. However, you can achieve something similar using a combination of built-in tools and external scripts:
1. Get Data Source Details in Power BI Desktop
- File >> Options and Settings >> Data Source Settings will show each source and connection type.
- Model View >> Properties can display the source details for each table.
- In Power Query, right-click a query >> Advanced Editor to see the exact M code (including the connection and query text).
2. Export Metadata via External Tools
- DAX Studio >> Advanced >>Export Metrics will produce a CSV with all tables, measures, and columns including source table names (for imported sources).
- Tabular Editor can read the model metadata and export it as JSON or CSV.
- The TOM (Tabular Object Model) via PowerShell or C# scripts can programmatically extract data source and query definitions from the PBIX file.
3. Automating Documentation
- You can build a PowerShell script (or use the Power BI REST API with Get Datasources In Group) to pull dataset connection info from the Power BI Service automatically and store it in a table for reference.
- For on-premises or gateway sources, the Get-PowerBIDatasource cmdlet in the MicrosoftPowerBIMgmt module can also retrieve server/database info.
5 Replies
- rohit1991Super User
Hi Vivek_BI
There isn’t currently a built-in feature in Power BI that automatically documents all data source details (server name, database, query text) into a table. However, you can achieve something similar using a combination of built-in tools and external scripts:
1. Get Data Source Details in Power BI Desktop
- File >> Options and Settings >> Data Source Settings will show each source and connection type.
- Model View >> Properties can display the source details for each table.
- In Power Query, right-click a query >> Advanced Editor to see the exact M code (including the connection and query text).
2. Export Metadata via External Tools
- DAX Studio >> Advanced >>Export Metrics will produce a CSV with all tables, measures, and columns including source table names (for imported sources).
- Tabular Editor can read the model metadata and export it as JSON or CSV.
- The TOM (Tabular Object Model) via PowerShell or C# scripts can programmatically extract data source and query definitions from the PBIX file.
3. Automating Documentation
- You can build a PowerShell script (or use the Power BI REST API with Get Datasources In Group) to pull dataset connection info from the Power BI Service automatically and store it in a table for reference.
- For on-premises or gateway sources, the Get-PowerBIDatasource cmdlet in the MicrosoftPowerBIMgmt module can also retrieve server/database info.
- v-venuppuCommunity Support
Hi Vivek_BI ,
Thank you for reaching out to Microsoft Fabric Community.
Thank you rohit1991 for the prompt response.
I wanted to check if you had the opportunity to review the information provided and resolve the issue..?Please let us know if you need any further assistance.We are happy to help.
Thank you.
- Shahid12523Community Champion
You can capture Power BI data source details like server names and queries using tools like DAX Studio, Tabular Editor, or PowerShell scripts. For cloud datasets, use the Power BI REST API to fetch connection info. To log everything into a table, you'd need to extract metadata manually or automate it with scripts.