Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply

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")),"")

 

 

 

bi.png

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@ThisIsHalloween First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

I gave this a shot but it is still looking the same:

 

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

RETURN
if(HASONEFILTER('Calendar'[FY]),IF(sum(Receipts[Net Amount]) <> 0,
CALCULATE(
(ReceiptsCurrentYear - ReceiptsPriorYear), DATESYTD('Calendar'[Date], "30/6")),""),
SUMX(
    (filter
        (Receipts, max('calendar'[fy]))),ReceiptsCurrentYear))

@ThisIsHalloween You didn't implement this correctly. ReceiptsCurrentYear is a variable and variables are static so I'm not sure what exactly you are summing there in that last SUMX but it's going to be the same number just repeated over and over and over which I can't imagine is correct. The solution presented shows to get a measure that calculates correctly at the individual row level and then create a second measure that returns that measure at the row level and a SUMX of the measure at the total level.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

I tried again and the totals are still not correct. Where am I messing up the hasonefilter formula?

 

Difference = 

VAR RPY = 

CALCULATE(
    sum(Receipts[Net Amount]),
    PARALLELPERIOD('Date'[Date],-12,month))


VAR RCY = 
    CALCULATE(
        SUM(Receipts[Net Amount]))


RETURN

if(HASONEFILTER('Date'[FY]),
    if(sum(Receipts[Net Amount]) <> 0,
        CALCULATE(
            (RCY - RPY), DATESYTD('Date'[Date], "30/6")), "0"))

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors