Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
darrenfishell
Advocate II
Advocate II

Enable access to usage metric reports across workspaces via UsageMetricsDataConnector.GetMetricsData

There should be a much simpler way to access PowerBI usage data across a given tenant. For my use case, separate workspaces are part of our distribution model to different audiences (via apps). To compare adoption across these audiences, I need to view usage data across workspaces, not one at a time. 

It seems from the Usage Metrics Data sources that this should be easily accessible. 

For instance, here is the PowerQuery script to retrieve the "Report views" table that is used in the default Usage Metrics Report source (BaseUrl = https://WABI-US-NORTH-CENTRAL-C-PRIMARY-redirect.analysis.windows.net)

 

 

 

let
    Source = UsageMetricsDataConnector.GetMetricsData(BaseUrl & "/metadata/v201906/metrics/workspace/" & WorkspaceId & "/reportviews"),
    metricsTable = Table.FromRecords(Source),
    checkForEmptyTable = if Table.IsEmpty(metricsTable) then
                        Table.FromRows
                        (
                            {
                            },
                            {
                                "ReportId", "ReportType", "ReportName", "AppName", "UserKey", "UserId", "UserAgent", "DatasetName", "DistributionMethod", "CapacityId", "CapacityName", "CreationTime", "ConsumptionMethod"
                            }
                        )
                        else
                        metricsTable,
    finalTable = Table.TransformColumnTypes(checkForEmptyTable, {{"CreationTime", type datetime}}),
    #"Renamed Columns" = Table.RenameColumns(finalTable,{{"ConsumptionMethod", "OriginalConsumptionMethod"}}),
    #"Replaced Value" = Table.ReplaceValue(#"Renamed Columns","Apps","App",Replacer.ReplaceText,{"DistributionMethod"})
in
    #"Replaced Value"

 

 

 

UsageMetricsDataConnector.GetMetricsData() should be accessible in Dataflows and/or PowerBI desktop to create custom tenant-wide views of usage data. 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

There is no guarantee whatsoever that the workspace usage metrics datasets will be refreshed or even kept.  Do not base your business processes on these.  Use the tenant audit log instead, it is stored "forever" and can always be retrieved.

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

There is no guarantee whatsoever that the workspace usage metrics datasets will be refreshed or even kept.  Do not base your business processes on these.  Use the tenant audit log instead, it is stored "forever" and can always be retrieved.

Much appreciated and very helpful. Thank you!

My confusion about these default Usage Metrics still deepens. Nothing about that data source or presentation seems to follow best BI practices, which is a major gap for a leading BI tool. 

couldn't have said it better...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors