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..
That's correct.
Powerbi and multiple companies pulls so much data that it can take hours.
There is no good way to use powerBI and dynamics together when multiple companies are involved.
There
have been baby steps over the years to improve this. But it's a dead end to use these technologies together with multiple companies.
it's too bad. The fix should be simple.