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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
NenadV
Helper III
Helper III

Is it possible to pass variable to OData query filter?

So I want to filter data that is coming from OData feed by date, I want to pull just rows where date column value is in last 7 days. I create variable:

SevenDaysAgo = Date.AddDays(DateTime.LocalNow(),-7),
year = Number.ToText(Date.Year(SevenDaysAgo)),
month = if Date.Month(SevenDaysAgo)<10 then Text.Combine({"0",Number.ToText(Date.Month(SevenDaysAgo))}) else Number.ToText(Date.Month(SevenDaysAgo)),
day = if Date.Day(SevenDaysAgo)<10 then Text.Combine({"0",Number.ToText(Date.Day(SevenDaysAgo))}) else Number.ToText(Date.Day(SevenDaysAgo)),
dateText = Text.Combine({year,"-",month,"-",day,"Z"})

 

and then I am using this variable dateText in my  OData query:

Source = OData.Feed("https://analytics.dev.azure.com/myOrgName/_odata/v3.0-preview/WorkItems?
$filter=Project/ProjectName eq 'ProjName' 
&$select=SomeColumns
&$apply=filter((WorkItemType eq 'Bug' or WorkItemType eq 'Task')and Iteration/EndDate ge "& dateText &")&$expand=Iteration($select=IterationName,EndDate,Depth,StartDate))")

 

This works fine in Power BI Desktop, but when I publish report to PBI Service, I get error message "Query contains unsupported function. Function name: OData.Feed"

I googled a lot about this topic but I did not find any solution, so I hope that somebody have some solution for this problem?

1 REPLY 1
v-eachen-msft
Community Support
Community Support

Hi @NenadV ,

 

You could refer to this similar case:

https://community.powerbi.com/t5/Service/PBI-app-cannot-load-odata-feed-with-M-functions-in-the-URL/...

Here is a blog for more details:

https://blog.crossjoin.co.uk/2018/05/03/troubleshooting-data-refresh-performance-issues-with-odata-d...

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.