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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
modeco
Frequent Visitor

Dynamics NAV account schedule

I need to create a Power BI Finance report with data from our Dynamics NAV system. The goal is to use Account Schedule table from Dynamics NAV where GL account grouping is set up. The setup consists of two main columns “Group name” and “GL accounts” which contains account filter for accounts that are included in the group. For example, we have a group “operational expenses” containing such account filter: 7501..7508|7124|7130 (meaning that the group includes all accounts from 7501 until 7508 and 7124 and 7130).

There are many groups and each group may have diferent range of accounts.

Two dots “..” means “from-to” connection, and vertical line “|” means OR.

From my understanding I need is to transform this setup into such format:

 

Group name

GL accounts

operational expenses

7501

operational expenses

7502

operational expenses

7503

operational expenses

7504

operational expenses

7505

operational expenses

7506

operational expenses

7507

operational expenses

7508

operational expenses

7124

operational expenses

7130

 

Is it possible to get this done in query mode or using DAX? Can anyone give a hint on how to get this done?

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @modeco,

 

Please refer to below formula to analysis custom filter formula:

Spoiler
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjc1MNTTA5IWNeaGRiZAwthAKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Fitler = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Fitler", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each 
Table.AddColumn(Table.ExpandListColumn(Table.AddColumn(Table.FromList(Text.Split([Fitler],"|"), Splitter.SplitByNothing(),{"List"}, null, ExtraValues.Error), "Account", each if Text.Contains([List],"..") 
then List.Numbers(Number.From(Text.Split([List],".."){0}),Number.From(Text.Split([List],".."){1})- Number.From(Text.Split([List],".."){0})+1) else null), "Account"), "Result", each if [Account] <> null then [Account] else [List])[Result]),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
    #"Changed Type1" = Table.TransformColumnTypes(#"Expanded Custom",{{"Custom", Int64.Type}})
in
    #"Changed Type1"

Result:

2.PNG

 

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

6 REPLIES 6
v-shex-msft
Community Support
Community Support

Hi @modeco,

 

Please refer to below formula to analysis custom filter formula:

Spoiler
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjc1MNTTA5IWNeaGRiZAwthAKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Fitler = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Fitler", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each 
Table.AddColumn(Table.ExpandListColumn(Table.AddColumn(Table.FromList(Text.Split([Fitler],"|"), Splitter.SplitByNothing(),{"List"}, null, ExtraValues.Error), "Account", each if Text.Contains([List],"..") 
then List.Numbers(Number.From(Text.Split([List],".."){0}),Number.From(Text.Split([List],".."){1})- Number.From(Text.Split([List],".."){0})+1) else null), "Account"), "Result", each if [Account] <> null then [Account] else [List])[Result]),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
    #"Changed Type1" = Table.TransformColumnTypes(#"Expanded Custom",{{"Custom", Int64.Type}})
in
    #"Changed Type1"

Result:

2.PNG

 

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

Hi v-shex-msft, can you post the solution again - how you managed to split the | into rows.

The solution formula seems to be gone. 

The formula is still there - in the formula widget - it can be expanded on my mobile browser. But somehow my desktop browser is not able to expand and show the formula inside the widget - I guess its because of JavaScripts on the page is being blocked. Anyways - a similar solution - and according to a colleague of mine - without error in some circumstances (unfortunately the details about the error is lost to me?!) - has been made by Imke Feldmann on her blog site - and its awesome: https://www.thebiccountant.com/2018/10/27/create-list-of-accounts-from-nav-account-schedules-totalli...

This is absolutely brilliant - nothing less! Have been searching the net for months now for this elegant solution (my brain just couldn't crack the nut).

 

Now I just have to figure out howe to deal with the additive codes that occurs in the [Totaling] column for [Totaling Type] = 2 - that has to be handled as a parent-child hierarchy (multiple parents?) - and take into account how to deal with subtraction (child members with a "unary operator").

 

Thank you, sir!

... did you crack that nut ?

... did you crack that nut ?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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