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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
charlieswing
Microsoft Employee
Microsoft Employee

Invoke-PowerBIRestMethod: $top parameter doesn't work when on Refresh history (GET /refreshes)

I am trying to use the following GET refreshes method (using Invoke-PowerBIRestMethod Powershell cmdlet) to retrieve refresh history on a particular dataset. I'm wanting to use the {$top} parameter (as mentioned in this PBI documentation) to return the top 1 refresh history however when I run this I get 40+ refresh instances.


I am using this URL:
GET https://api.powerbi.com/v1.0/myorg/datasets/{datasetId}/refreshes?$top=1

 

I'm thinking this is a bug unless I'm just missing something. Anyone else experiencing this? Again - the api returns refresh history but it does not limit the responses like its supposed to.

1 ACCEPTED SOLUTION
AEsquivel-AMPM
New Member

Hi @charlieswing , I found the solution; it is not a Power BI bug. The problem is when you add a $ in text using PowerShell it is interpreted as a variable; in other words, you have to escape the $ with `

 

$workspace_id = "your_workspace_id"
$dataset_id = "your_dataset_id"

$url_refresh_history = "https://api.powerbi.com/v1.0/myorg/groups/"+$workspace_id+"/datasets/"+$dataset_id+"/refreshes?`$top=2"

 

View solution in original post

5 REPLIES 5
AEsquivel-AMPM
New Member

Hi @charlieswing , I found the solution; it is not a Power BI bug. The problem is when you add a $ in text using PowerShell it is interpreted as a variable; in other words, you have to escape the $ with `

 

$workspace_id = "your_workspace_id"
$dataset_id = "your_dataset_id"

$url_refresh_history = "https://api.powerbi.com/v1.0/myorg/groups/"+$workspace_id+"/datasets/"+$dataset_id+"/refreshes?`$top=2"

 

Anonymous
Not applicable

@Anonymous Is this an answer? You only posted a URL that I am already using.

Anonymous
Not applicable

GSun_0-1655171755451.png

GSun_1-1655171871679.png

 

Anonymous
Not applicable

Yes, I have tested it and there is no problem

Helpful resources

Announcements
Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.