Forum Discussion
Using the Dynamics Business Central Connector, how can I add date filters?
- 4 years ago
I figured it out.
The Business Central connector using the Power BI Odata connector, and the authorizaton is built in.
So the doucumentation I was looking for is the in the Odata connector.
The Odata Connector is well designed and folds and filters back to the Odata source.
So the solution to my problem was dead simple, just add a filter to the query and you get the period you want.
Here's a sample of the M code.
It was all created using the GUI, no advaced editor required.
Chose the income statements table, then add a date filter with the date you want the data for.
let
Source = Dynamics365BusinessCentral.ApiContents(null, null, null),
PRODUCTION = Source{[Name="PRODUCTION"]}[Data],
#"DC Hospitality Apex LLC" = PRODUCTION{[Name="Test Company 1"]}[Data],
v2.0 = #" Test Company 1"{[Name="v2.0"]}[Data],
incomeStatements_table = v2.0{[Name="incomeStatements",Signature="table"]}[Data],
#"Filtered Rows" = Table.SelectRows(incomeStatements_table, each [dateFilter] = #date(2022, 1, 31))
in
#"Filtered Rows"
#The marked solution:
This only filters after the table is loaded in to Power Query, so no query folding to the API.
Think the only way to do this is to talk directly to the BC API and not use the Connector from MS, but need to test this..
Getting data out of Business Central into PowerBI is difficult.
We have multiple small companies in our case.
Getting an update involved pulling huge amounts of data and an update can take 45 minutes.
And the first thing that is done is to filter it down.
It's remarkable that it has not been addressed to date.
I think the integration partner community is focussed on finance only and BI is at best an after thought.