Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Building a P&L matrix with calculated lines (data source is Dynamics 365 business central)

Hi all,  Wondering if someone can help.  I have linked my PBI file to Dynamics 365 business central and pulled through both the genral ledger and chart of accounts tables and created a relationship...
  • DataInsights's avatar
    DataInsights
    4 years ago

    Anonymous,

     

    Try this solution using the native matrix. It requires more setup, however, and the result is a matrix that may not meet the formatting requirements. I recommend trying the Profitbase Financial Reporting Matrix. Finance users love it, as it offers many advantages including the ability to create subtotals, add blank rows, apply specific formatting, etc.

     

    Add EBITDA to the Lookup table, along with an Index column for sorting Category:

     

     

    Data model:

     

     

    In the GL Entries table, create a calculated column to flip the sign. You can also do this in Power Query.

     

    Adjusted Amount = 
    SWITCH (
        TRUE,
        'GL Entries'[GL Code] >= 1001
            && 'GL Entries'[GL Code] < 2000, 'GL Entries'[Amount],
        'GL Entries'[GL Code] >= 2001
            && 'GL Entries'[GL Code] < 3000, 'GL Entries'[Amount] * -1
    )

     

    Create measure:

     

    Total Amount = 
    CALCULATE (
        SUM ( 'GL Entries'[Adjusted Amount] ),
        CROSSFILTER ( 'Chart of Accounts'[GL Code], 'Lookup Table'[GL Code], BOTH )
    )

     

    Result: