Forum Discussion
Value from last week
Hello all,
I'm trying to collect whatever the value is from last week within a custom column. Below is an example of what it would look like
VAR most_recent_date = LASTDATE('data'[date]) -7
Thanks in advance for any help!!
Remember that you have to calculate this from the point of view of the visual element if you do this as a measure.
So instead of
VAR most_recent_date = LASTDATE('data'[date]) -7
you would say
VAR most_recent_date =DATEADD('data'[date]), -7,DAY)
Note that "the value from last week" is not the same as "the value from the day seven days before the current day"
2 Replies
- lbendlin
Super User
Remember that you have to calculate this from the point of view of the visual element if you do this as a measure.
So instead of
VAR most_recent_date = LASTDATE('data'[date]) -7
you would say
VAR most_recent_date =DATEADD('data'[date]), -7,DAY)
Note that "the value from last week" is not the same as "the value from the day seven days before the current day"
- AnonymousNot applicable
Hello Anonymous
Please see if the following query.
Prev Week Sales =LOOKUPVALUE('Table'[Sale Value],'Table'[Date],DATEADD('Table'[Date],7,DAY))Hope this helps.Kindly accept it as a solution if it satisfies your requirement.