Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi,
Need help on DAX , client requested to show last 4 years sales with current YTD.
Thanks,
Francis
Solved! Go to Solution.
Hi @Anonymous ,
Please mark the answer as solution if it works.
If not, please show some sample data and expected result to us.
Best Regards,
Jay
@Anonymous , I think you need the last 4 years + data till today
Try like
Last 4 year till date =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = eomonth(_max,-1*MONTH(_max) -48 )+1
return
CALCULATE([net] ,filter('Date', 'Date'[Date]>= _min && 'Date'[Date]<= _max))
or
Last 4 year till date =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = eomonth(_max,-1*MONTH(_max) -48 )+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.