Forum Discussion

ThisIsHalloween's avatar
2 years ago

Sum Total is Incorrect When Comparing Two Fiscal Years When One is Not Over

I am trying to create a table where I am subtracting the current fiscal year totals by month by the same period last year. We have a lag on our data and are viewing data a month or two past when it occured. Below is exactly what I want the chart to look like except for the total is incorrect. I know it is because it is treating April, May, and June as $0 for this current fiscal year minus the receipts from last fiscal year. But I cannot figure out how to fix it. I am still very new to PowerBI so I still have a lot to learn. 

 

 

 

Difference = 
VAR ReceiptsPriorYear = 
CALCULATE(
    sum(Receipts[Net Amount]),
    PARALLELPERIOD(
        'Calendar'[Date],
        -12,MONTH))
VAR ReceiptsCurrentYear = 
CALCULATE(
    Sum(Receipts[Net Amount]))

RETURN
if((sum(Receipts[Net Amount])) <> 0,
CALCULATE(
(ReceiptsCurrentYear - ReceiptsPriorYear), DATESYTD('Calendar'[Date], "30/6")),"")

 

 

 

4 Replies