Power BI CLI Samples for Power BI datasets
The following table includes links to bash and PowerShell scripts built using the Power BI CLI.
Script | Description |
---|---|
List datasets | List datasets |
Execute query | Execute DAX query to a (premium) dataset |
Update refresh schedule | Update a dataset refresh schedule |
List datasets
List datasets the user/service principal has access to for a certain workspace
pbicli dataset list --workspace Demos
Execute query
Update a dataset refresh schedule which is stored in a JSON file in the current directory
pbicli dataset query --workspace Demos --dataset Demos --dax "EVALUATE(TOPN(1, 'Customer'))"
Update refresh schedule
Executes a DAX query to a premium dataset
pbicli dataset refresh update --workspace Demos --dataset Demos --refresh-schedule @refresh-schedule.json
Schedule definition file that enables the schedule for a dataset to be fereshed at Sunday, Tuesday, Friday and Saturday at 7:00, 11:30, 16:00 and 23:30 UTC.
# refresh-schedule.json
{
"value": {
"days": ["Sunday", "Tuesday", "Friday", "Saturday"],
"times": ["07:00", "11:30", "16:00", "23:30"],
"localTimeZoneId": "UTC",
"enabled": true
}
}