Metareport – Power BI Report of Power BI Reports

This Power BI report lists reports from a couple of workspaces in my Power BI tenant.

A Fabric Notebook calls the Power BI REST API to get a list of all reports in each workspace, then for each report gets report metadata and exports an image of the first report page into a PNG file. It then resizes the PNG files to create smaller thumbnails, converts them into base64-encoded images split into small chunks, and saves the metadata and base64 chunks into a table in a Lakehouse.

The data is imported from the Lakehouse into the semantic model. A measure is used to concatenate the base64 chunks into an image URL, so the thumbnails can be displayed in the Button slicer and Image visuals.


Power BI REST API end points used to prepare the data

https://learn.microsoft.com/en-us/rest/api/power-bi/groups/get-groups – returns a list of workspaces the user has access to.

https://learn.microsoft.com/en-us/rest/api/power-bi/reports/get-reports-in-group – returns a list of reports from the specified workspace.

https://learn.microsoft.com/de-de/rest/api/power-bi/reports/get-pages-in-group – returns a list of pages within the specified report from the specified workspace.

https://learn.microsoft.com/en-us/rest/api/power-bi/reports/export-to-file-in-group – exports the specified report from the specified workspace to the requested file format.

https://learn.microsoft.com/en-us/rest/api/power-bi/reports/get-export-to-file-status – returns the current status of the Export to File job for the specified report.

https://learn.microsoft.com/en-us/rest/api/power-bi/reports/get-file-of-export-to-file – returns the file from the Export to File job for the specified report.

https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/get-refresh-history-in-group – returns the refresh history for the specified dataset from the specified workspace.

PySpark (Python) Notebook

https://github.com/avatorl/Fabric/tree/main/metareport

DAX

The Notebook creates a table with report metadata and a table with base64-encoded images split into maximum 8,000-character chunks. The chunks are needed as a workaround for Power Query (32K characters) and the Lakehouse SQL endpoint (8,000 characters) limitations.

The measure returns either a report thumbnail (base64-encoded PNG image) or an SVG image with the “No Image” label when there is no thumbnail available.

Image =
VAR Base64Body =
    ( CONCATENATEX ( ‘Reports’, ‘Reports'[Value], “”, ‘Reports'[Attribute], ASC ) )
VAR _Result =
    IF (
        Base64Body = “”,
        “data:image/svg+xml;utf8,<svg xmlns=’http://www.w3.org/2000/svg’><rect width=’100%’ height=’100%’ fill=’#f0f0f0’/>” & “<text x=’50%’ y=’50%’ text-anchor=’middle’ dominant-baseline=’middle’ fill=’#999′ font-family=’Arial, sans-serif’ font-size=’32’>No Image</text>” & “</svg>”,
        “data:image/png;base64,” & Base64Body
    )
RETURN
    _Result

Change the data category of the measure to Image URL:

Add this measure as an image into one of the visuals that support embedded images (I used the Button slicer and Image visual):


Share the article