<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to Apply a Date Filter When Exporting a Power BI Report via API in a PySpark Notebook? in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4635987#M8381</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="866741" data-lia-user-login="liney_marcela" class="lia-mention lia-mention-user"&gt;liney_marcela&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thank you for sharing your findings on the date filter behavior in the Power BI API. It's helpful to know that the filter works correctly for older dates but not for recent ones. This seems to be a system limitation, and your feedback on this issue is valuable.&lt;/P&gt;
&lt;P&gt;If you have already submitted a suggestion regarding this, it will help with potential improvements in future updates.&lt;/P&gt;
&lt;P&gt;Please consider accepting your response as a solution to assist other community members facing a similar issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Apr 2025 04:37:34 GMT</pubDate>
    <dc:creator>v-saisrao-msft</dc:creator>
    <dc:date>2025-04-03T04:37:34Z</dc:date>
    <item>
      <title>How to Apply a Date Filter When Exporting a Power BI Report via API in a PySpark Notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4613610#M7992</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;I am using a PySpark Notebook to export a Power BI report in PDF format via the API. I managed to export it with page-level filters and some filters applied via code. However, I cannot apply a date filter during the export process.&lt;/P&gt;&lt;P&gt;Here is the code I am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import requests
import json

page_name = "xxxx"
apply_filters = True  

url = f"https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/reports/{reportId}/ExportTo"

payload = {
    "format": "PDF",
    "powerBIReportConfiguration": {
        "pages": [
            {
                "pageName": page_name,
            }
        ]
    }
}

if apply_filters:
    payload["powerBIReportConfiguration"]["reportLevelFilters"] = [
        { 
            "filter": "CU_00x_xx/Columna_Fecha eq '2025-12-01'"  
        }
    ]

headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {access_token}"
}

response = requests.post(url, headers=headers, data=json.dumps(payload))

if response.status_code == 202:
    exportId = response.json().get("id")
    print(f"Export started. ID: {exportId}")
else:
    print(f"Export error: {response.status_code} - {response.text}")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue is that the date filter is not applied correctly in the exported report. Am I using the correct format for the date in reportLevelFilters? Should I use a different syntax or structure for the API to recognize it?&lt;/P&gt;&lt;P&gt;Any help or examples on how to properly apply a date filter in this case would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 21:41:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4613610#M7992</guid>
      <dc:creator>liney_marcela</dc:creator>
      <dc:date>2025-03-17T21:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to Apply a Date Filter When Exporting a Power BI Report via API in a PySpark Notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4613639#M7993</link>
      <description>&lt;P&gt;if you use the V3 format, you must qualify it with the full date time. Date literals like "datetime'2019-05-20'" aren't supported in V3 notation. But you can just write it as "2019-05-20" in V4 notation. Here are two equivalent filter queries in V3 and V4:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;OData V4 format: filter=Table/Date gt 2019-05-20&lt;/LI&gt;
&lt;LI&gt;OData V3 format: filter=Table/Date gt datetime'2019-05-20T00:00:00'&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-url-filters" target="_blank"&gt;Filter a report using query string parameters in the URL - Power BI | Microsoft Learn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 22:10:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4613639#M7993</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2025-03-17T22:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to Apply a Date Filter When Exporting a Power BI Report via API in a PySpark Notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4615650#M8029</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="866741" data-lia-user-login="liney_marcela" class="lia-mention lia-mention-user"&gt;liney_marcela&lt;/a&gt;,&lt;BR /&gt;I wanted to check if you had the opportunity to review the information provided by &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;. Please feel free to contact us if you have any further questions. If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.&lt;BR /&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 05:25:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4615650#M8029</guid>
      <dc:creator>v-saisrao-msft</dc:creator>
      <dc:date>2025-03-19T05:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to Apply a Date Filter When Exporting a Power BI Report via API in a PySpark Notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4617240#M8071</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your response! I really appreciate your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tested both formats you mentioned:&lt;BR /&gt;- OData V4: `filter=Table/Date gt 2019-05-20`&lt;BR /&gt;- OData V3: `filter=Table/Date gt datetime'2019-05-20T00:00:00'`&lt;/P&gt;&lt;P&gt;Unfortunately, I was still unable to filter by date in my report. Other filters (such as text or numerical values) work correctly, but the date filter doesn’t seem to be applied.&lt;/P&gt;&lt;P&gt;Would you have any additional suggestions on what might be causing this issue?&lt;/P&gt;&lt;P&gt;Thanks again for your time!&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 21:54:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4617240#M8071</guid>
      <dc:creator>liney_marcela</dc:creator>
      <dc:date>2025-03-19T21:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to Apply a Date Filter When Exporting a Power BI Report via API in a PySpark Notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4621292#M8146</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="866741" data-lia-user-login="liney_marcela" class="lia-mention lia-mention-user"&gt;liney_marcela&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;Thank you for reaching out to the Microsoft Fabric Forum Community.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;It seems you're encountering difficulties with applying a date filter when exporting your Power BI report using the REST API. Since text and numerical filters are functioning correctly, the problem likely lies in the filter syntax, the column’s data type, or the way the report processes the filter.&lt;/SPAN&gt;&lt;SPAN data-ccp-props="{&amp;quot;335559738&amp;quot;:240,&amp;quot;335559739&amp;quot;:240}"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;Here are a few suggestions to help troubleshoot and resolve the issue:&lt;/SPAN&gt;&lt;SPAN data-ccp-props="{&amp;quot;335559738&amp;quot;:240,&amp;quot;335559739&amp;quot;:240}"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI data-leveltext="" data-font="Symbol" data-listid="1" data-list-defn-props="{&amp;quot;335552541&amp;quot;:1,&amp;quot;335559685&amp;quot;:720,&amp;quot;335559991&amp;quot;:360,&amp;quot;469769226&amp;quot;:&amp;quot;Symbol&amp;quot;,&amp;quot;469769242&amp;quot;:[8226],&amp;quot;469777803&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;469777804&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;469777815&amp;quot;:&amp;quot;hybridMultilevel&amp;quot;}" aria-setsize="-1" data-aria-posinset="1" data-aria-level="1"&gt;&lt;SPAN data-contrast="auto"&gt;To apply a date filter using the Power BI REST API, make sure you're using the correct OData V4 syntax. For Date type columns, a simple format like YYYY-MM-DD should work. For DateTime columns, you need to provide the full date-time value in the YYYY-MM-DDT00:00:00 format. Unlike OData V3, V4 doesn’t require a datetime prefix, simplifying the filtering process.&lt;/SPAN&gt;&lt;SPAN data-ccp-props="{}"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI data-leveltext="" data-font="Symbol" data-listid="1" data-list-defn-props="{&amp;quot;335552541&amp;quot;:1,&amp;quot;335559685&amp;quot;:720,&amp;quot;335559991&amp;quot;:360,&amp;quot;469769226&amp;quot;:&amp;quot;Symbol&amp;quot;,&amp;quot;469769242&amp;quot;:[8226],&amp;quot;469777803&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;469777804&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;469777815&amp;quot;:&amp;quot;hybridMultilevel&amp;quot;}" aria-setsize="-1" data-aria-posinset="1" data-aria-level="1"&gt;&lt;SPAN data-contrast="auto"&gt;Make sure the Columna_Fecha column in your Power BI report is set as a Date or DateTime type. If it's stored as Text or String, the API won't recognize the date filter. You can check and update the data type using Power BI Desktop in the Data view or the Modeling tab.&lt;/SPAN&gt;&lt;SPAN data-ccp-props="{}"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI data-leveltext="" data-font="Symbol" data-listid="1" data-list-defn-props="{&amp;quot;335552541&amp;quot;:1,&amp;quot;335559685&amp;quot;:720,&amp;quot;335559991&amp;quot;:360,&amp;quot;469769226&amp;quot;:&amp;quot;Symbol&amp;quot;,&amp;quot;469769242&amp;quot;:[8226],&amp;quot;469777803&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;469777804&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;469777815&amp;quot;:&amp;quot;hybridMultilevel&amp;quot;}" aria-setsize="-1" data-aria-posinset="1" data-aria-level="1"&gt;&lt;SPAN data-contrast="auto"&gt;Ensure that the table and column names in your API request match the actual names in your Power BI dataset. If the names contain spaces or special characters, enclose them in single quotes. You can verify the correct names using the Fields pane in Power BI Desktop.&lt;/SPAN&gt;&lt;SPAN data-ccp-props="{}"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI data-leveltext="" data-font="Symbol" data-listid="1" data-list-defn-props="{&amp;quot;335552541&amp;quot;:1,&amp;quot;335559685&amp;quot;:720,&amp;quot;335559991&amp;quot;:360,&amp;quot;469769226&amp;quot;:&amp;quot;Symbol&amp;quot;,&amp;quot;469769242&amp;quot;:[8226],&amp;quot;469777803&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;469777804&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;469777815&amp;quot;:&amp;quot;hybridMultilevel&amp;quot;}" aria-setsize="-1" data-aria-posinset="1" data-aria-level="1"&gt;&lt;SPAN data-contrast="auto"&gt;If your export request succeeds but the filter isn’t applied, use the Get Export to File Status API endpoint to check detailed information about the export status. It can indicate whether the filter was applied or ignored. Also, confirm that your API token has the necessary permissions to apply report-level filters.&lt;/SPAN&gt;&lt;SPAN data-ccp-props="{}"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;Please refer to the links below for more information:&lt;/SPAN&gt;&lt;SPAN data-ccp-props="{}"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/reports/export-to-file" target="_blank"&gt;&lt;SPAN data-contrast="none"&gt;Reports - Export To File - REST API (Power BI Power BI REST APIs) | Microsoft Learn&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN data-ccp-props="{}"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/reports/export-to-file-in-group" target="_blank"&gt;&lt;SPAN data-contrast="none"&gt;Reports - Export To File In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN data-ccp-props="{}"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;helps, then please give us ‘Kudos’ and consider&amp;nbsp;Accept it as a solution&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Mar 2025 14:45:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4621292#M8146</guid>
      <dc:creator>v-saisrao-msft</dc:creator>
      <dc:date>2025-03-23T14:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to Apply a Date Filter When Exporting a Power BI Report via API in a PySpark Notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4625116#M8211</link>
      <description>&lt;P&gt;&lt;SPAN data-teams="true"&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="866741" data-lia-user-login="liney_marcela" class="lia-mention lia-mention-user"&gt;liney_marcela&lt;/a&gt;,&lt;BR /&gt;I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.&lt;BR /&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Mar 2025 04:31:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4625116#M8211</guid>
      <dc:creator>v-saisrao-msft</dc:creator>
      <dc:date>2025-03-26T04:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to Apply a Date Filter When Exporting a Power BI Report via API in a PySpark Notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4630453#M8300</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="866741" data-lia-user-login="liney_marcela" class="lia-mention lia-mention-user"&gt;liney_marcela&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We haven’t heard back from you regarding your issue. If it has been resolved, please mark the helpful response as the solution and give a ‘Kudos’ to assist others. If you still need support, let us know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Mar 2025 15:55:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4630453#M8300</guid>
      <dc:creator>v-saisrao-msft</dc:creator>
      <dc:date>2025-03-29T15:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to Apply a Date Filter When Exporting a Power BI Report via API in a PySpark Notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4631863#M8322</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for your response. However, I have already validated the reason why the date filter is not applied, and it is because it only works for old dates like 19XX. Therefore, I have already made a suggestion regarding this restriction.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Mar 2025 16:44:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4631863#M8322</guid>
      <dc:creator>liney_marcela</dc:creator>
      <dc:date>2025-03-31T16:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to Apply a Date Filter When Exporting a Power BI Report via API in a PySpark Notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4635987#M8381</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="866741" data-lia-user-login="liney_marcela" class="lia-mention lia-mention-user"&gt;liney_marcela&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thank you for sharing your findings on the date filter behavior in the Power BI API. It's helpful to know that the filter works correctly for older dates but not for recent ones. This seems to be a system limitation, and your feedback on this issue is valuable.&lt;/P&gt;
&lt;P&gt;If you have already submitted a suggestion regarding this, it will help with potential improvements in future updates.&lt;/P&gt;
&lt;P&gt;Please consider accepting your response as a solution to assist other community members facing a similar issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Apr 2025 04:37:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-Apply-a-Date-Filter-When-Exporting-a-Power-BI-Report-via/m-p/4635987#M8381</guid>
      <dc:creator>v-saisrao-msft</dc:creator>
      <dc:date>2025-04-03T04:37:34Z</dc:date>
    </item>
  </channel>
</rss>

