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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello community.
I have a formula that calculates the purchase value; however, within that calculation I am telling you to only consider the month of December. I also have several segmenters that I use as a filter such as year and month, and when I select a month other than December, I get 0 in my formula.
DAX formula:
Purchase value LP = CALCULATE ([Purchase value], DATEADD (Calendar [Date], - 1, YEAR), Calendar [Month No.] = 12)
I need to do the following:
1. If a closed or finished year is selected, you should always take the data for the month of December of the previous year.
2. When filtering any month from the segmenter, the measure must not change, it must remain fixed with the month of December of the previous year.
I thank you in advance for your support.
Reggards,
DC
Solved! Go to Solution.
@DanCasSan, if there are any other filter that can delete month, then you may not get data for dec ,
You can get the last month of last year as
example: date is my calendar table
el año pasado el pasado MTD Ventas ?
var _max á datediff(startofyear('Date'[Date],"12/31"), maxx(allselected('Date'), 'Date'[Date]),month)
devolución
CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1*_max,MONTH)))
@DanCasSan, if there are any other filter that can delete month, then you may not get data for dec ,
You can get the last month of last year as
example: date is my calendar table
el año pasado el pasado MTD Ventas ?
var _max á datediff(startofyear('Date'[Date],"12/31"), maxx(allselected('Date'), 'Date'[Date]),month)
devolución
CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1*_max,MONTH)))
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!