Hi,
I am trying to build a P&L based on the Finance Reporting showcase video but i am having real performance issues relating to a percentage change measure it’s taking forever to calculate.
My report has 4 slicers:
Year - options are 2018, 2019 or 2020
Currency - options are GBP or LCY
Entity - options are UK, Norway or USA
Comparison - options are Budget or Prior year
I’ve loaded my code into Dax studio which tells me I have 608 SE queries which watching some other videos anything above 20 is not the best.
Any help would be appreciated, this is my measure:
CY v LY % =
VAR CurrentItem = SELECTEDVALUE(‘P&L_Template’[Items (Normalized)])
Return
SWITCH(TRUE(),
CurrentItem = "Revenue", DIVIDE([CY v LY], [Revenue LY],0)*1000,
CurrentItem = "Cost of Sales", DIVIDE([CY v LY], [COS LY],0)*1000,
CurrentItem = "Overheads", DIVIDE([CY v LY], [Overheads LY],0)*1000,
CurrentItem = "EBITDA", DIVIDE([CY v LY], [EBITDA LY],0)*1000,
CurrentItem = "Profit Before Tax", DIVIDE([CY v LY], [PBT LY],0)*1000,
CurrentItem = "Tax", DIVIDE([CY v LY], [Tax LY],0)*1000,
CurrentItem = "Profit After Tax", DIVIDE([CY v LY], [PAT LY],0)*1000,
CurrentItem = "Gross Margin", DIVIDE([CY v LY], [Gross Margin LY],0)*1000,
CurrentItem = "Gross Margin %", [Gross Margin %] - [Gross Margin % LY],
CurrentItem = "EBITDA %", [EBITDA %] - [EBITDA % LY])
This is the actual query that i loaded into Dax studio:
// DAX Query
DEFINE
VAR __DS0FilterTable =
TREATAS({“UK”}, ‘Entities’[Country])
VAR __DS0FilterTable2 =
TREATAS({“GBP”}, ‘Currency’[Currency Selection])
VAR __DS0FilterTable3 =
TREATAS({“2019”}, ‘Dates’[Year])
VAR __DS0FilterTable4 =
TREATAS({“Prior Year”}, ‘Comparison’[Comparison])
EVALUATE
TOPN(
501,
SUMMARIZECOLUMNS(
‘P&L_Template’[Row Index],
‘P&L_Template’[Income Statement Items],
__DS0FilterTable,
__DS0FilterTable2,
DS0FilterTable3,
DS0FilterTable4,
“Selected_Year_Actuals”, ‘Annual Analysis’[Selected Year Actuals],
“Comparison_Actuals”, ‘New Measures’[Comparison Actuals],
"Comparion_Diff", ‘Visual Selections’[Comparion Diff.],
"Comparion_Diff", ‘Visual Selections’[Comparion Diff. %]
),
‘P&L_Template’[Row Index],
1,
‘P&L_Template’[Income Statement Items],
1
)
ORDER BY
‘P&L_Template’[Row Index], ‘P&L_Template’[Income Statement Items]