Forum Discussion
Getting 2 years back total !
Hi All,
something simple I think but can't get it to work.
I have a graph where I am showing last years won deals :
- Anonymous4 years ago
Hi Jitmondo ,
You could try use edate() function. Please check this measure.
measure =
var _date =selectedvalue('date'[date])
return
calculate(sum([value]),filter(allselected('table'),'table'[date]>=date(year(_date)-2,1,1)&&'table'[date]<=edate(_date,-24)))
Best Regards,Jay
4 Replies
- AnonymousNot applicable
Good morning Jitmondo
Please check this previus answer and see if they work for you:
Solved: TOTALYTD with SAMEPERIODLASTYEAR not working as ex... - Microsoft Power BI Community
If you have a slicer with the dates they should work.
Regards!
- JitmondoHelper III
thanks for replying, my last year (sameperiodlast year) works fine. I am trying to see if there is a way to alter this measure or a new measure to show the year before last...
- AnonymousNot applicable
Please check PARALELLPERIOD function then, it should work 🙂
PARALLELPERIOD function (DAX) - DAX | Microsoft Docs
Your interval should be -2 for example:
CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]), PARALLELPERIOD(DateTime[DateKey],-2,year))
- AnonymousNot applicable
Hi Jitmondo ,
You could try use edate() function. Please check this measure.
measure =
var _date =selectedvalue('date'[date])
return
calculate(sum([value]),filter(allselected('table'),'table'[date]>=date(year(_date)-2,1,1)&&'table'[date]<=edate(_date,-24)))
Best Regards,Jay