Forum Discussion

ThiemenSiemensm's avatar
ThiemenSiemensm
Frequent Visitor
3 years ago
Solved

subtotals

Good afternoon,   I have a problem using an addition scheme to calculate (sub)-totals where the values to be filled in the scheme coming from a different table (NAV). I have two tables, 1 is the s...
  • TomasAndersson's avatar
    3 years ago

    Hi!
    Totaling from NAV? I wrestled with that a while back. This is problably not the most efficient solution, but I managed to get it to work.

    First I added an Index column to the Chart of Accounts (in Power Query) so that I had that alongside account no, First Min and First Max. I also had the NAV totaling description as a columns, sort of like this:

     



    Then i used the following:

     

    Totaling Account SEK = 
    SUMX('Chart of Accounts', 
        IF( 
           'Chart of Accounts'[Totaling]<>"",  // If not a totaling account 
            CALCULATE ([Sum SEK], //Use basic sum of amount from general ledger table  
                FILTER(ALL('Chart of Accounts'), //else calculate sum of all accounts between min and max
                'Chart of Accounts'[Index] >= EARLIER('Chart of Accounts'[Totaling 1 Start]) 
                && 'Chart of Accounts'[Index] <= EARLIER('Chart of Accounts'[Totaling 1 End])
            )
        )
    )

     

     You'd have to change the column names, and instead of 'Chart of Accounts'[Totaling]<>"" you'd have to look for a blank First Min or First Max instead.

     

    This is a measure as well, and maybe needs to be adjusted if you want a calculated column.

    Hope this helps you a bit. I don't have time to write a better guide right now but let me know otherwise and I can look into it in a day or two.

     

    Good luck!