Forum Discussion

Vivek_BI's avatar
Vivek_BI
New Member
1 year ago
Solved

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...
  • rohit1991's avatar
    1 year ago

    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.