Forum Discussion
SHDJason
Advocate II
10 years agoparallelperiod vs previousmonth vs adddate
Hi All, I found a solution to this already but am confused about why it is so. I need to find a simple previous month lookup. Prev. Month Sales = CALCULATE(SUM([Total Sales]),DATEADD(...
- 10 years ago
Hi SHDJason,
In DAX, PARALLELPERIOD always returns full periods at the given granularity level instead of the partial periods that DATEADD returns. So please check if the dates in date column are continuous. If the dates in the current context do not form a contiguous interval, the function returns an error.
Reference:
PARALLELPERIOD Function (DAX)Regards,
SamiTi
8 years agoFrequent Visitor
Hi, The solution is that you need to select 1 month in order for measure to return Previous month value.
Hope this helps,
Sam
Noak
Helper IV
8 years agoHi SamiTi
I figured it our:
Parallel Period = VAR MinDate = MIN ( Date[Column] ) VAR StartDate = DATE ( YEAR ( MinDate ) - 1, MONTH ( MinDate ), DAY ( MinDate ) ) VAR MaxDate = MAX ( Date[Column] ) VAR EndDate = DATE ( YEAR ( MaxDate ) - 1, MONTH ( MaxDate ), DAY ( MaxDate ) ) RETURN CALCULATE ( [Measure], FILTER ( ALL ( DateColumn/Table ), Date[Column] >= StartDate && Date[Column] <= EndDate ) )