Forum Discussion
Reference a previous month using variables in DAX using slicers
have you looked at the previousmonth and sameperiodlastyear etc functions in dax?
https://msdn.microsoft.com/en-us/library/ee634972.aspx
https://msdn.microsoft.com/en-us/library/ee634758.aspx
Hi vanessafvg
It is going of week number not months or last year. I understand that when you use these it generates a table and I think it is due to table being constrained the month selected but for this purpose I need to sort of see if it is in the previous month and use that.
- vanessafvg9 years agoCommunity Champion
Anonymous you can probably use use datedd with a filter
for example
CALCULATE ( SUM ( 'Table'[Sales Amount] ), FILTER ('Table', 'Table'[Date] ) = DATEADD ( 'Table'[Date], -7, DAY )CALCULATE ( SUM ( 'Table'[Sales Amount] ), FILTER ('Table', 'Table'[Date] ) = DATEADD ( 'Table'[Date], -1, WEEK)haven't test this this though
- Anonymous9 years agoNot applicable
There is no week unfortunalty, only day/month/quarter/year, if we do -7
Something like
internetTargets[weeknum]= WEEKNUM((DATEADD ( 'Calendar$'[Date], -7, DAY ))))
It does not allow you to use dateadd in a filter expression
FILTER ('Table', 'Table'[Date] ) = DATEADD ( 'Table'[Date], -7, DAY )- vanessafvg9 years agoCommunity Champion
FILTER ('Table', 'Table'[Date] = DATEADD ( 'Table'[Date], -7, DAY ))you have a comma /bracket in the wrong place
this is how i would do it
CALCULATE(sum(internettarget), filter('Date', 'Date'[Date] = dateadd('Date'[Date], - 7, DAY)))