Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I am trying to deploy reports to workspaces using PowerShell scripts. Our organization uses the same pbix file skeleton and changes to client datasource in their respective workspaces. We achieve this by connecting first to an empty database and once published, change to client specific data sources and credentials. We also have the Incremental refresh set up for these reports.
The flow of report deployment goes as follow,
publish the report with empty db --> full refresh to create partitions --> "ClearValues" refresh to clear values in partition --> update datasource and credentials --> transactional refresh.
I do this to clear the values in partitions and fill them with client data for the created partitions.
The challenge is the API call I make to clear values in the partition is not working as expected. The call is made successfully but it is not clearing the values. Hence, when the last call is made, correct data is not filled in the existing partitions.
I also noticed that refresh types for these calls are Via Api instead of Via Enhanced Api.
Has anyone else experienced this? Does anyone maybe have a more elegant solution?
Solved! Go to Solution.
Hi @RamyaRascher ,
The Power BI REST API is a REST-based API that provides programmatic access to Dashboard resources such as Datasets, Tables, and Rows in Power BI. The Enhanced API is a new version of the Power BI REST API that provides additional functionality and performance improvements over the previous version. The Enhanced API is currently in preview and is available to use alongside the existing Power BI REST API.
To clear the data in the partitions of a Power BI dataset using PowerShell, you can use the Invoke-RestMethod cmdlet in PowerShell to call the Power BI REST API and send a DELETE request to the partitions endpoint of the dataset. Here is an example PowerShell script that clears the data in the partitions of a dataset:
$token = Get-PowerBIAccessToken
$authHeader = @{ 'Authorization' = "Bearer $token" }
$datasetId = '<your dataset ID>'
$partitionsEndpoint = "https://api.powerbi.com/v1.0/myorg/datasets/$datasetId/partitions"
Invoke-RestMethod -Uri $partitionsEndpoint -Headers $authHeader -Method DELETE
This script first gets an access token for the Power BI REST API using the Get-PowerBIAccessToken cmdlet. It then constructs an authorization header using the access token. The script then specifies the dataset ID and constructs the partitions endpoint URL. Finally, the script sends a DELETE request to the partitions endpoint using the Invoke-RestMethod cmdlet to clear the data in the partitions of the dataset。
Best Regards
Hi @RamyaRascher ,
The Power BI REST API is a REST-based API that provides programmatic access to Dashboard resources such as Datasets, Tables, and Rows in Power BI. The Enhanced API is a new version of the Power BI REST API that provides additional functionality and performance improvements over the previous version. The Enhanced API is currently in preview and is available to use alongside the existing Power BI REST API.
To clear the data in the partitions of a Power BI dataset using PowerShell, you can use the Invoke-RestMethod cmdlet in PowerShell to call the Power BI REST API and send a DELETE request to the partitions endpoint of the dataset. Here is an example PowerShell script that clears the data in the partitions of a dataset:
$token = Get-PowerBIAccessToken
$authHeader = @{ 'Authorization' = "Bearer $token" }
$datasetId = '<your dataset ID>'
$partitionsEndpoint = "https://api.powerbi.com/v1.0/myorg/datasets/$datasetId/partitions"
Invoke-RestMethod -Uri $partitionsEndpoint -Headers $authHeader -Method DELETE
This script first gets an access token for the Power BI REST API using the Get-PowerBIAccessToken cmdlet. It then constructs an authorization header using the access token. The script then specifies the dataset ID and constructs the partitions endpoint URL. Finally, the script sends a DELETE request to the partitions endpoint using the Invoke-RestMethod cmdlet to clear the data in the partitions of the dataset。
Best Regards
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
9 | |
7 | |
2 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
4 |