Forum Discussion
jfranco
2 years agoFrequent Visitor
DAX Calculated Column - Value from a same date previous year
Hello and Good Morning. I have another question from the knowledge base. I have the following table: ID Location Date Production A North 01/01/2024 10 B North 01/01/2024 ...
- 2 years ago
Thank you Anonymous
Thank you!
Almost but not quite.
I ended up creating two columns
M = Month(Table[Date])
PY = Year(Table[Date])
and then using a variation of your DAX code :
CALCULATE (SUM([Production)]),FILTER(ALL(Table),Table[ID]=EARLIER(Table[ID])&& Table[Location] = EARLIER(Table[Location])&& Month(Table[Date]) = Earlier(Table[M])&& Year(Table[Date]) = EARLIER(Table[PY]) )))Gracias
Roger
jfranco
2 years agoFrequent Visitor
Something else I've tried:
Added Two Columns:
LYM = MONTH (DATE)
LY = YEAR (DATE) -1
Then tried :
CALCULATE (SUM([Production]),
MONTH([Date]) = [LYM],
year([Date]) = [LY]))
But still get blanks...any idea what I'm doing wrong?