RE: NAV 2016 - How are G_L Entries (SQL Table) linked to GL Register (Table)
This was my answer or what work for us and I hope it helps you too
---------
So, I bring to the Power BI report two dataset: G/L Entries and G_L Register. This can be through a SQL View or a SQL Script as it is not always necessary to have all the columns from both source (NAV) tables. The me I add a column [Entry No_] from G/L Entries table and this is done by a INNER JOIN of G_L Register table. I need multiple company, but you may not so as a backdrop, I have UNION ALL the individual companies together for each: G/L Entries and G_L Register.
The INNER JOIN is the [Entry No_] BETWEEN the [From Entry No_] AND [To Entry No_]. Again, because I am multicompany I have added a column to both called [Parent] or you could call [Company} and so in the JOIN the two [Parent] columns are joined so that Register entries are unique across all companies. If for you one company just leave this off.
Again I am using a view and not a SQL Script directly in Power BI for the datasets, but a SQL Script could be used as well. This then requires either the Personal Gateway or the On-Premise Gateway so that you can refresh these if you publish to Power BI Services (to a Workspace). Else if you are local and just using Power BI Desktop then the gateway comment is not necessary. Lastly, I add to custom columns before I use merge queries in Power BI Query Editor. It is the same column to each of the datasets. only because I am multicompany. This is the Entry No which is now in both dataset and the [Parent] column which for me is the company. that way they are unique. The join is a LEFT OUTER (all from First and matching from second). If you are not multicompany then you'll just JOIN on the [Entry No_].
If you do this all in Power Query from the Merge Queries it is still complicated, but the JOIN does not give you natively the BETWEEN for both columns in the Register dataset. and you have to insert a custom script.
example (generic): if [Entry No_] >= [From Entry No_] and [Entry No_] <= [To Entry No_] then true else false
I prefer to do most if not all the hard work in SQL either is a script or a SQL view.
ps. I hope this helps. Your partner or your DBA or a data analyst might be able to help you further.
For me the goal was to add these columns from the Register dataset to the G_L Entries dataset.