Forum Discussion
Anonymous
9 years agoNot applicable
Reference a previous month using variables in DAX using slicers
Hi I am trying to reference the last week using some dax code that Greg_Deckler provided. I got the last week working but it only works after the firstr week in a given month. How would I ...
vanessafvg
9 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
Anonymous
9 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)))
- 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
- vanessafvg9 years agoCommunity Champion
Anonymous ag ok make sense, probably need to use week numbers then, perhaps using the function earlier could help? if you had a week number in your date table?