Hello @mbraun,
Thank You for posting your query onto the Forum.
Well yes, there’s a bit of formula error. The formula used in the given report contains the referencing error and I’m providing below the revised formula to calculate the variance between the Selected Year and the Previous Year.
CY vs PY Actuals 1 % =
VAR CurrentItem = SELECTEDVALUE( 'Income Statement Template'[Items (Normalized)] )
RETURN
SWITCH( TRUE() ,
CurrentItem = "Total Revenues" , DIVIDE( [Revenues] - [Revenues LY] , [Revenues LY] , 0 ) ,
CurrentItem = "Total COGS" , DIVIDE( [COGS] - [COGS LY] , [COGS LY] , 0 ) ,
CurrentItem = "Total Gross Profit" , DIVIDE( [Gross Profit] - [Gross Profit LY] , [Gross Profit LY] , 0 ) ,
CurrentItem = "Total Other Expenses" , DIVIDE( [Other Expenses] - [Other Expenses LY] , [Other Expenses LY] , 0 ) ,
CurrentItem = "Total Net Profit" , DIVIDE( [Net Profit] - [Net Profit LY] , [Net Profit LY] , 0 ) ,
CurrentItem = "Gross Profit %" , [% Gross Profit Margin] - [% Gross Profit Margin LY] ,
CurrentItem = "Net Profit %" , [% Net Profit Margin] - [% Net Profit Margin LY] ,
DIVIDE( [CY vs PY Actuals] ,
ABS(
CALCULATE(
CALCULATE( [Actuals (,000)] ,
FILTER( 'Income Statement Template' , [Particulars] = CurrentItem ) ) ,
DATEADD( Dates[Date] , -1 , YEAR ) ) ) , 0 ) )
And now, you’ll see that the results shown below in the provided screenshot shall be the desired one that you’re looking for.
And just for the reference, due to the wrong referencing in the formula as provided below it provided the ultimately undesired result. Below is the wrong formula and the results derived from that is provided for the reference -
CY vs PY Actuals 2 % =
VAR CurrentItem = SELECTEDVALUE( 'Income Statement Template'[Items (Normalized)] )
RETURN
SWITCH( TRUE() ,
CurrentItem = "Total Revenues" , DIVIDE( [CY vs PY Actuals] , [Revenues LY] , 0 ) ,
CurrentItem = "Total COGS" , DIVIDE( [CY vs PY Actuals] , [COGS LY] , 0 ) ,
CurrentItem = "Total Gross Profit" , DIVIDE( [CY vs PY Actuals] , [Gross Profit LY] , 0 ) ,
CurrentItem = "Total Other Expenses" , DIVIDE( [CY vs PY Actuals] , [Other Expenses LY] , 0 ) ,
CurrentItem = "Total Net Profit" , DIVIDE( [CY vs PY Actuals] , [Net Profit LY] , 0 ) ,
CurrentItem = "Gross Profit %" , [% Gross Profit Margin] - [% Gross Profit Margin LY] ,
CurrentItem = "Net Profit %" , [% Net Profit Margin] - [% Net Profit Margin LY] ,
DIVIDE( [CY vs PY Actuals] ,
ABS(
CALCULATE(
CALCULATE( [Actuals (,000)] ,
FILTER( 'Income Statement Template' , [Particulars] = CurrentItem ) ) ,
DATEADD( Dates[Date] , -1 , YEAR ) ) ) , 0 ) )
I’m also attaching the working of the PBIX file for the reference.
Please Note: Sheet - 1 contains the visualizations with the correct results and Sheet - 2 contains the visualizations with the wrong result (created just for the explanation/understanding purpose).
Hoping you find this useful and helps you to achieve the results that you’re looking for.
Thanks and Warm Regards,
Harsh
Income Statement - Harsh.pbix (863.1 KB)