Forum Discussion

LuigiBros's avatar
LuigiBros
Icon for Helper I rankHelper I
1 year ago
Solved

Custom Usage Metrics Report (for all reports and all workspaces)

I have an ambitious plan to create a single "golden" report to monitor the usage of all reports across all workspaces.

What would be the best approach for this?

 

Has anyone done something similar and could share insights or tutorials?


I was able to connect to the Power BI API, but I’m not entirely sure where to find all the necessary information.

 

The first issue I encountered is that I’m sharing reports via apps (not direct report links), and access is granted based on Azure AD groups (not individual emails). However, when querying the API (GetAppUsersAsAdmin and similar queries), I only get group email addresses in the results, whereas I would like to see individual users.

 

Could you please help?

  • Hi LuigiBros ,

    Favourable Approach is:

    1. Connect to Power BI REST API

      • Use the Admin API to get usage details across workspaces.
      • Key endpoints:
        • GetActivityEvents → Fetch user activity logs.
        • GetReportsAsAdmin → List all reports.
        • GetAppUsersAsAdmin → Fetch app access details.
    2. Extract Individual Users from Azure AD Groups

      • API returns group emails, not individual users.
      • Use Microsoft Graph API (/groups/{id}/members) to expand group members.
      • Store user mappings in a separate dataset.
    3. Build a Power BI Report

      • Load API data into Power BI via Power Query (Web Connector).
      • Model relationships between reports, workspaces, users, and access logs.
      • Use DAX measures for insights like most-viewed reports, active users, and trends.


    Challenges & Solutions:

    Issue: API limits (e.g., GetActivityEvents pulls 30 days of data).
    ➡ Solution: Schedule incremental refresh for continuous tracking.

    Issue: Access data is in groups, not users.
    ➡ Solution: Use Microsoft Graph API to resolve group members.

5 Replies

  • Hi LuigiBros ,

    Favourable Approach is:

    1. Connect to Power BI REST API

      • Use the Admin API to get usage details across workspaces.
      • Key endpoints:
        • GetActivityEvents → Fetch user activity logs.
        • GetReportsAsAdmin → List all reports.
        • GetAppUsersAsAdmin → Fetch app access details.
    2. Extract Individual Users from Azure AD Groups

      • API returns group emails, not individual users.
      • Use Microsoft Graph API (/groups/{id}/members) to expand group members.
      • Store user mappings in a separate dataset.
    3. Build a Power BI Report

      • Load API data into Power BI via Power Query (Web Connector).
      • Model relationships between reports, workspaces, users, and access logs.
      • Use DAX measures for insights like most-viewed reports, active users, and trends.


    Challenges & Solutions:

    Issue: API limits (e.g., GetActivityEvents pulls 30 days of data).
    ➡ Solution: Schedule incremental refresh for continuous tracking.

    Issue: Access data is in groups, not users.
    ➡ Solution: Use Microsoft Graph API to resolve group members.

  • rohit1991 

     

    do you know if it is possible to join together all Usage Metrics Reports from all workspaces into one?

    And is it possible to add additional table to the model? 

    I want to export all users from Azure AD with Power BI license and check how many of them are not using reports at all.

  • hyodokatsuki's avatar
    hyodokatsuki
    Frequent Visitor

    Read data from semantic models and write data that semantic models can consume using python - Microsoft Fabric | Microsoft Learn

     

    Using Semantic Link, you can extract data from the Usage Metrics semantic model in a notebook. By incrementally updating and accumulating the data appropriately, you can also enable long-term analysis. By parameterizing the workspace portion, you can consolidate data across multiple workspaces.

    Since GetActivityEvents does not include page-level view information, it is ideal to extract data from Usage Metrics instead.

     

    %%pyspark
    import sempy.fabric as fabric
    
    workspace = "<workspace_name>"
    dataset = "Usage Metrics Report"
    table_name = "Report Page views"
    
    dax = f"EVALUATE '{table_name}'"
    
    df = fabric.evaluate_dax(dataset, dax, workspace=workspace)