Forum Discussion
Reference a previous month using variables in DAX using slicers
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.
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 ago
Community 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)))
- Anonymous9 years agoNot applicable
Hi Vanessa,
I am trying to get the full previous week rather than just one day
Thanks for helping though...much appreciated.
Chris