The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I'm using PowerBI's ExportTo API. The report filters seem to be ignored.
I tried like this
https://api.powerbi.com/v1.0/myorg/groups/xxxx/reports/xxxx/ExportTo
{
"format": "PDF",
"powerBIReportConfiguration": {
"reportLevelFilters": [
{
"filter": "Calendario documento/Documento - Anni trascorsi da ultimo reload lt '5'"
}
],
"datasetToBind": "xxx",
"identities": [
{
"username": "0_0_0_0",
"roles": [ "NORLS" ],
"datasets": [ "xxxx" ]
}
]
}
}
So the API returns 200 but the filter seems to be ignored.
I've already tried these syntaxes but nothing works. Any ideas?
'Calendario documento'[Documento - Anni trascorsi da ultimo reload] eq 5
[Calendario documento]/[Documento - Anni trascorsi da ultimo reload] eq 5
[Calendario documento]/[Documento - Anni trascorsi da ultimo reload] eq '5'
Calendario documento/Documento - Anni trascorsi da ultimo reload eq '5'
Thanks in advance
Solved! Go to Solution.
I did a test with spaces in the table name and column name:
Table name: ex1 renamed
Column name: Column three
This requeust body produced a filtered result:
Reqused body:
{
"format": "PDF",
"powerBIReportConfiguration": {
"settings": {},
"reportLevelFilters": [
{
"filter": "ex1_x0020_renamed/Column_x0020_three lt 0"
}
]
}
}
@DavideBono97did you try applying the same filter string in Power BI web portal through the URL as explained here Filter a report using query string parameters in the URL - Power BI | Microsoft Learn ?
Usually if the filter string works in the URL the same string will also work in the ExportTo API.
You should certainly not use the basic filter schema when calling the exportTo API.
Hi
Thanks for the update
With url filter it works
With this string with special characters because my table and columns have the space
&filter=Calendario_x0020_documento/Documento_x0020__x002D__x0020_Anni_x0020_trascorsi_x0020_da_x0020_ultimo_x0020_reload eq 1
But in Api I don't expect to write it this way
Could it be the fault of the spaces on the API too?
Thanks to both of you @AmosHersch @v-sshirivolu
@DavideBono97 did you try the same string with special characters in the API? It might be an issue with the spaces.
@AmosHersch with this syntax not works
"reportLevelFilters": [
{
"filter": "Calendario?x0020?documento/Documento-x0020?x0020?x002D-x0020?Anni?x0020?trascorsi?x0020?da?x0020?ultimo-x0020?reload eq 1"
}
]
I have 200 status code but the filter is ignored
With this syntax i get the same error "Export report filter with empty string provided"
"reportLevelFilters": [
{
"$schema": "http://powerbi.com/product/schema#basic",
"target": {
"table": "Calendario?x0020?documento",
"column": "Documento-x0020?x0020?x002D-x0020?Anni?x0020?trascorsi?x0020?da?x0020?ultimo-x0020"
},
"operator": "Equals",
"values": [1]
}
]
I did a test with spaces in the table name and column name:
Table name: ex1 renamed
Column name: Column three
This requeust body produced a filtered result:
Reqused body:
{
"format": "PDF",
"powerBIReportConfiguration": {
"settings": {},
"reportLevelFilters": [
{
"filter": "ex1_x0020_renamed/Column_x0020_three lt 0"
}
]
}
}
I try with one table and column that no have space, but not works
In querystring in url on power bi works
"reportLevelFilters": [
{
"$schema": "http://powerbi.com/product/schema#basic",
"target": {
"table": "Operatori",
"column": "Operatore"
},
"operator": "Equals",
"values": ["asd"]
}
]
@DavideBono97 the API does NOT work with this schema
"$schema": "http://powerbi.com/product/schema#basic",
No need for any schema, see the example I've shared which is working good. No schema in, and NO json object for the filter.
I try with this and works!
Good, **bleep** spaces
{
"filter": "Calendario_x0020_documento/Documento_x0020__x002D__x0020_Anni_x0020_trascorsi_x0020_da_x0020_ultimo_x0020_reload eq 1"
}
Thanks a lot of both of you
Hi @v-sshirivolu
I've already tried this way
But I get this error :
{
"error": {
"code": "InvalidRequest",
"message": "Export report filter with empty string provided"
}
}
Hi @DavideBono97 ,
This error typically occurs when the filter is correctly set up, but Power BI cannot locate a corresponding field in the dataset, resulting in it being treated as an empty string. Please consider the following checks:
Table and column names: Ensure they match exactly with your dataset, including spaces, spelling, and special characters. For instance, verify that your table is named Calendar document and the column is Document - Anni trascorsi da ultimo reload.
Remove aliases: If fields have been renamed in your report, use the original dataset field names.
Value type: For numeric columns, input numbers without quotes (e.g., "values": [5]). For text columns, enclose values in quotes (e.g., "values": ["5"]).
Test with Equals first: Begin by using "operator": "Equals" with a simple value to confirm the filter binds correctly. Once successful, you can switch to LessThan.
For reference, here is a sample test filter:
"reportLevelFilters": [
{
"$schema": "http://powerbi.com/product/schema#basic",
"target": {
"table": "Calendario documento",
"column": "Documento - Anni trascorsi da ultimo reload"
},
"operator": "Equals",
"values": [5]
}
]
If this test is successful, you can then update the operator to LessThan as needed.
Hi
I try this solution but not works
This is true name of column and table
The value is numeric
I try with Equal operator but not works
It is possible the error is for the space on the column and table ?
Thanks and sorry
Hi @DavideBono97 ,
Thank you for the update.
This error can occur if there are spaces or special characters in your table or column names, or if the names do not exactly match those in the dataset schema. Please verify that you are using the original field names from the dataset, rather than any renamed fields from the report. For columns with spaces or hyphens, ensure the spelling matches the dataset precisely.
Hi @DavideBono97 ,
Thanks for reaching out to Microsoft Fabric Community Forum.
Try this Solution
Please use the correct asynchronous export flow:
Step 1 – Start Export
POST https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/reports/{reportId}/ExportTo
Returns an exportId.
Step 2 – Poll Export Status
GET https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/reports/{reportId}/exports/{exportId}
Do not use /status. Poll until "Succeeded" or "Failed".
Step 3 – Download File
GET https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/reports/{reportId}/exports/{exportId}/file
Example Flow
Start export - get exportId = abc123
Poll: GET …/exports/abc123 → returns "Succeeded"
Download: GET …/exports/abc123/file
Reference :
https://learn.microsoft.com/en-us/power-bi/developer/embedded/export-to
Best Regards,
Sreeteja.
Hi
I don't have a problem with export-to operations, I already use these
My problem is the reportLevelFilters, this is ignored
I'm asking you if I'm using the wrong syntax
Thanks
Hi @DavideBono97 ,
The reason your filter is ignored is because reportLevelFilters does not accept plain strings.
You need to pass it in the official filter schema format, for example:
"reportLevelFilters": [
{
"$schema": "http://powerbi.com/product/schema#basic",
"target": {
"table": "Calendario documento",
"column": "Documento - Anni trascorsi da ultimo reload"
},
"operator": "LessThan",
"values": [5]
}
]
This way the filter will be applied correctly during ExportTo.
Ref: Power BI embedded analytics documentation - Power BI | Microsoft Learn