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!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
hello,
i have a table with all the purchasing order that look like this:
now i want to compare the difference beetween two years but only for the item that was alredy purchased a year before a given date
is it possibile with dax or i have to work with the data structure?
Solved! Go to Solution.
You can create a measure like
Sales of prior year products =
var latestYear = MAX( 'Date'[Year])
var priorYearProducts = CALCULATETABLE( VALUES('Orders'[Code]), 'Date'[Year] = latestYear - 1)
return CALCULATE([Sales Amount], priorYearProducts)
and you can build similar logic into comparison measures etc.
You can create a measure like
Sales of prior year products =
var latestYear = MAX( 'Date'[Year])
var priorYearProducts = CALCULATETABLE( VALUES('Orders'[Code]), 'Date'[Year] = latestYear - 1)
return CALCULATE([Sales Amount], priorYearProducts)
and you can build similar logic into comparison measures etc.