Forum Discussion
Help using SQl to limit the data being pulled form Microsoft Dynamics by Odata
Hi mike_asplin
As you are using odata, it is possible to acheive that
You can find more information under the following link:
https://www.odata.org/getting-started/basic-tutorial/
But to achieve that, you can edit your power query with the following approach:
let
Url = "https://chaxxxxx.api.crm11.dynamics.com/api/data/v9.1/",
SelectColumns = "name,_cha_clientid_value,_owningteam_value,duration,starttime,_cha_carercontactid_value,_msdyn_workorder_value,msdyn_totalcost,endtime,statuscode,msdyn_milestraveled,msdyn_actualarrivaltime",
FilterDateText = DateTime.ToText(Dateparameter, "yyyy-MM-ddTTHH:mm:ssZ"),
FilterQuery = "$filter=starttime ge " & FilterDateText,
ODataQueryOptions = [
Query = "$select=" & SelectColumns & "&$" & FilterQuery
],
Source = OData.Feed(Url, null, [Implementation="2.0"]),
bookableresourcebookings_table = Source{[Name="bookableresourcebookings", Signature="table"]}[Data],
Data = OData.Feed(bookableresourcebookings_table, null, ODataQueryOptions)
in
Data
Just to be sure to call the date Parameter to Dateparameter and replace the url by the right url and it should work
Seems ot be taking for ever. Can I check there arent any typoes
Whats the ge for?
FilterQuery = "$filter=starttime ge " & FilterDateText,
Why is time surrounded by TT and Z?
FilterDateText = DateTime.ToText(Dateparameter, "yyyy-MM-ddTTHH:mm:ssZ"),
Thanks
- v-lgarikapat1 year agoCommunity Support
Hi mike_asplin ,
Thanks for reaching out to the Microsoft fabric community forum
Thanks for your prompt response,
1.
FilterQuery = "$filter=starttime ge " & FilterDateText,
ge is one of the OData comparison operators, and it stands for:
ge = Greater than or Equal to
It’s the OData equivalent of SQL’s >=. So when you write:
text
$filter=starttime ge 2025-08-01T00:00:00Z
2.
FilterDateText = DateTime.ToText(Dateparameter, "yyyy-MM-ddTTHH:mm:ssZ"),
T
Time separator between date and time
2025-08-01T00:00:00
Z
Zulu time (UTC) indicator
2025-08-01T00:00:00Z
Open Data Protocol (OData) - Finance & Operations | Dynamics 365 | Microsoft Learn
We truly appreciate your continued engagement and thank you for being an active and valued member of the community.
If you're still experiencing any challenges, please don’t hesitate to reach out we’d be more than happy to assist you further.
We look forward to hearing from you.
Best regards,
Lakshmi- v-lgarikapat11 months agoCommunity Support
Hi mike_asplin ,
We’d like to confirm whether your issue has been successfully resolved. If you still have any questions or need further assistance, please don’t hesitate to reach out. We’re more than happy to continue supporting you.
We appreciate your engagement and thank you for being an active part of the community.
Best Regards,
Lakshmi.- mike_asplin11 months agoHelper V
Hi sorry I'm getting same error . The step above seems to produce a table so maybe this step isnt needed?