Forum Discussion

Neehar's avatar
Neehar
Helper I
4 years ago

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

  • 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's avatar
      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

      • Neehar's avatar
        Neehar
        Helper I

        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