When the Report Usage Metrics Report stops refreshing

Have you ever had a Usage Metrics Report just stop refreshing? At the bottom you’ll see a little message that tells you to check the credentials. But you don’t have access to the Usage Metrics Report dataset in the list of datasets in the workspace because it’s hidden! So even if you wanted to delete it and nicely ask it to start again, you can’t do it from the workspace. What can you do? Well, you can delete the Usage Metrics Report dataset with the Power BI Rest API.

First, start a Windows PowerShell session. Make sure that you have the Power BI cmdlets installed by running the following in an elevated PowerShell session:

Install-Module -Name MicrosoftPowerBIMgmt

Next, you will have to log in to Power BI, so run:

Login-PowerBI

To delete a dataset, you’ll need to know the id of the workspace it’s in and the id of the dataset itself. To get the id of the workspace is easy. Go to the workspace and then in the URL, it’s the long guid right after “powerbi.com/groups/”. With that copied, you can now find all of the datasets in the workspace, including that Usage Metrics Report one that is hiding from you. You can do that by running:

Invoke-PowerBIRestMethod -Url groups/yourlongguidfortheidofyourworkspace/datasets -Method Get

This will return a bunch of json with all of the details about all of the datasets in your workspace, including the id. Scroll through it until you find the one that says “name”:”Usage Metrics Report” and copy the id value for that dataset. Then run the following to delete it:

Invoke-PowerBIRestMethod -Url groups/yourlongguidfortheidofyourworkspace/datasets/yourlongguidfortheidofyourdataset -Method Delete

And that’s it! Now go back to your workspace and click the three dots next to one of your reports and choose “View usage metrics report” to get it running again.

Comments

6 responses to “When the Report Usage Metrics Report stops refreshing”

  1. […] Stephanie Bruno fixes a credentials issue: […]

  2. Ahmed Avatar

    This right here is a valuable resource.

  3. Andrzej Avatar

    Thank you very much. It took 5 minutes to fix the problem with this detailed description.

  4. Paul Avatar

    I found you can do this without Powershell as well (as it’s disabled on my work machine so I can’t anyways). They have interactive API documentation for Power BI that lets you run the API calls directly in browser, and I was able to delete a broken usage dataset from there.

    https://learn.microsoft.com/en-us/rest/api/power-bi/

  5. garrett_the_fox Avatar

    Another solution would be to just tell the Usage Metrics Report dataset to refresh using the Power BI Dataset REST API: https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/refresh-dataset Then you would not need to delete the dataset.

  6. Stuart Cuthbertson Avatar

    Just in case this is helpful to anyone: I kept coming back to this post, so eventually I put this function/cmdlet in my PS $profile file:

    function Remove-PowerBIUsageMetricsReport {

    param ( [string]$WorkspaceName ) $null = Login-PowerBI # Suppress output $METRICS_NAME = 'Usage Metrics Report' # In case this ever changes $wid = (Get-PowerBIWorkspace -Scope Organization -Name $WorkspaceName).Id if ($wid -eq $null) { Write-Error "Workspace not found"; Return } $did = (Get-PowerBIDataset -Scope Organization -WorkspaceId $wid -Name $METRICS_NAME).Id if ($did -eq $null) { Write-Host "No $METRICS_NAME dataset found in $WorkspaceName workspace"; Return } Invoke-PowerBIRestMethod -Method Delete -Url "groups/$wid/datasets/$did"

    }

    Apologies this comment form has butchered the line breaks, but hopefully you can figure that out.