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
archuleta28
Resolver I
Resolver I

YOY calculation - last year data not populating

Hi,

 

New to DAX calculations, need your kind help.

 

I need to show comparison of data with the current year selected in the dropdown to its previous year. Here, first I was trying to calculate YOY comparision so I had made two measures:

 

LogisticCost LastYr = CALCULATE(SUM('sheet'[Actual Cost]), DATEADD('sheet'[Invoice Date],-1,YEAR))

LogisticCost CurrentYr = SUM('sheet'[Actual Cost])

 

But, now the Last year value is not populating : 

vaibhavius_4-1667896912422.png

 

vaibhavius_2-1667896442522.png

 

Can anyone please help me why is this happening and how this can be corrected?

 

Thanks.
1 ACCEPTED SOLUTION
v-yinliw-msft
Community Support
Community Support

Hi @archuleta28 ,

 

The LY is blank because it is based on the current date. Because I lack the data.

So I create an sample table to explain it.

vyinliwmsft_0-1667978866365.png

 

If I use the formula you give, it will show like this:

vyinliwmsft_1-1667978866374.png

 

The data was calculated by the current year, not the last year.

So even if it has the true number, but in the wrong position.

 

You can try this method:

In my example, I set a date to separate the two fiscal year. I choose the Feb 1st, just an example, you can change it to what you need.

New measure LY:

LY =

-- set the Feb 1st as the boundary of every fiscal year

var _startdate = DATE(YEAR(TODAY()) - 1, 2,1)

var _Current = DATE(YEAR(TODAY()), 2 ,1 )

return

    CALCULATE(SUM('sheet'[Actual Cost]), FILTER('sheet', 'sheet'[Invoice Date] >= _startdate && 'sheet'[Invoice Date] <= _Current))

 

The result is:

vyinliwmsft_2-1667978866376.png

 

 

Hope this helps you. Here is my PBIX file.

 

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yinliw-msft
Community Support
Community Support

Hi @archuleta28 ,

 

The LY is blank because it is based on the current date. Because I lack the data.

So I create an sample table to explain it.

vyinliwmsft_0-1667978866365.png

 

If I use the formula you give, it will show like this:

vyinliwmsft_1-1667978866374.png

 

The data was calculated by the current year, not the last year.

So even if it has the true number, but in the wrong position.

 

You can try this method:

In my example, I set a date to separate the two fiscal year. I choose the Feb 1st, just an example, you can change it to what you need.

New measure LY:

LY =

-- set the Feb 1st as the boundary of every fiscal year

var _startdate = DATE(YEAR(TODAY()) - 1, 2,1)

var _Current = DATE(YEAR(TODAY()), 2 ,1 )

return

    CALCULATE(SUM('sheet'[Actual Cost]), FILTER('sheet', 'sheet'[Invoice Date] >= _startdate && 'sheet'[Invoice Date] <= _Current))

 

The result is:

vyinliwmsft_2-1667978866376.png

 

 

Hope this helps you. Here is my PBIX file.

 

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much for your help, it worked!  Really appreciate your efforts:)

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