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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Neehar
Helper I
Helper I

How to specify date range in PowerBIReportExportConfiguration ReportLevelFilters ?

Hi,

 

I want to specify a date range on a table column while exporting a report to pdf.

 

I'm following the below article for exporting

 

https://docs.microsoft.com/en-us/power-bi/developer/embedded/export-to

 

 

 var powerBIReportExportConfiguration = new PowerBIReportExportConfiguration
            {
                Settings = new ExportReportSettings
                {
                    Locale = "en-us",
                },
                Pages = new List<ExportReportPage>(),
                ReportLevelFilters = new List<ExportFilter>() { new ExportFilter("DateTable/DateColumn ge 2022-05-07 and DateTable/DateColumn le 2022-06-07'") }
            };

 

 

Please help me with the syntax.

 

Thank you 

6 REPLIES 6
Neehar
Helper I
Helper I

I have even tried the below code but it is not working

 

 //ReportLevelFilters = new List<ExportFilter>() { new ExportFilter("DateTable/DateColumn lt '2022-05-13T00:00:00' and DateColumn gt '2022-05-10T00:00:00'") } //Not working

 

Please help

Anonymous
Not applicable

HI @Neehar,

You can try to use the full URL filter string in your request to ensure if it works:

 

 ReportLevelFilters = new List<ExportFilter>() { 
    new ExportFilter("?filter=DateTable/DateColumn lt '2022-05-07' and DateTable/DateColumn gt '2022-06-07'") 
}

 

In addition, you can also add a breakpoint to trace the request structure to check the concatenated request contents then you can modify the filter string based on these contents.

Regards,

Xiaoxin Sheng

Hi @Anonymous ,

 

I have tried to apply the filter using the above code snippet, but it is not working.

ReportLevelFilters = new List<ExportFilter>() { new ExportFilter("?filter=DateTable/Date lt '01/20/2013' and DateTable/Date gt '01/04/2013'") } 

 

Thanks | Neehar 

 

@Neehar 

I believe you don't need to add the "?filter=" prefix.

I am using something like 

ReportLevelFilters = new List<ExportFilter>() { new ExportFilter("Geo/Region eq 'East') };

 

My suggestion - first try your filter in Power BI portal URL as described here:

https://docs.microsoft.com/en-us/power-bi/collaborate-share/service-url-filters

And once you get it to work correctly it should work for you in the API (but without the "?filter=")

Hi, @AmosHersch ,

Thanks for the reply, I've even tried removing the ?filter. It didn't work with the date type column but works with the string type column.
I tried the below syntax 

    //ReportLevelFilters = new List<ExportFilter>() { new ExportFilter("RandomData/Date lt '01/20/2013' and RandomData/Date gt '01/04/2013'") } //not working
    //ReportLevelFilters = new List<ExportFilter>() { new ExportFilter("RandomData/Date lt '01/20/2013' and Date gt '01/04/2013'") } //not working
    // ReportLevelFilters = new List<ExportFilter>() { new ExportFilter("RandomData/Date gt '01/04/2013'") } //not working
    //ReportLevelFilters = new List<ExportFilter>() { new ExportFilter("RandomData/Name eq 'Neehar'") } //Working

 

Thanks | Neehar 

 

@Neehar asking again - does the same date filter work for the same report when appended to the URL in Power BI portal?

Did you read here: https://docs.microsoft.com/en-us/power-bi/collaborate-share/service-url-filters#date-data-types ?

Sounds like it worth trying something like: "RandomData/Date gt 2013-01-20"

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.