Visualize your SQL database schema within Power Query
Often, we need to look for a table or for a specific column in the database. Do you know it’s possible to create a simple query to visualize your database schema within Power Query ? Very few steps for great results.
How to display database schema (first method with data preview)
- Add a blank query and name it ‘dbScheme’
- Open the advanced editor
- Copy this code and close advanced editor
let
Source = Sql.Database( yourserver , yourdatabase ),
#"Filtered Rows" = Table.SelectRows(Source, each ([Kind] = "Table")),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Schema", "Item", "Kind"})
in
#"Removed Columns"
Click on a table and see a sample of content

How to display database schema (second method)
Here is the whole query :
let
Source = Sql.Database("yourserver", "your database", [Query="
SELECT
c.TABLE_NAME as 'Table', c.COLUMN_NAME as 'Column'
FROM INFORMATION_SCHEMA.COLUMNS c
INNER JOIN
(SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
GROUP BY COLUMN_NAME
HAVING COUNT(*) > 1
) dupes
ON dupes.COLUMN_NAME = c.COLUMN_NAME
", CommandTimeout=#duration(0, 0, 1, 0)]),
#"Sorted Rows" = Table.Sort(Source,{{"TABLE_NAME", Order.Ascending}})
in
#"Sorted Rows"
How to (third method)
Phil Seamark method : Diagram your Database Tables using Power BI
See also how to document M functions : M functions documentation within Power Query
DAX debugger is meant to help Power BI report developers displaying sample data from a DAX formula. Measures, calculated columns and calculated tables can be …
Since the Power BI team allowed to launch external tools from the Power BI desktop ribbon, several tools became available. Do you know you can …
While working in Power BI desktop, we often need to export to Excel some data sharing with customers or colleagues. Once shared, we don’t want …
As Power BI Sidetools creates files from your report, you are able to search through DAX, M, the layout (report pages) and even the ‘Model.bim’ …
Compare DAX and M formulas in Visual Studio Code is really easy with the help of Power BI Sidetools.As it is possible to transfer DAX …
Translations life cycle management must be considered seriously as soon as we decide to translate Power BI reports. Translating a report in several languages takes …