Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Time Intelligence

Hi,

 

I have created a Calculated Table for Dates:

 

Date =

ADDCOLUMNS (

CALENDAR (DATE (2021, 01, 01), Today()),

"Year", YEAR([Date]),

"MonthNumber", MONTH([Date]),
"Month", FORMAT([Date],"mmmm"),
"WeekNumber", FORMAT(WEEKNUM([Date],2),"00"),
"Quarter", QUARTER([Date]),

"DayOfWeek", WEEKDAY([Date])

)
 
I also have a measure called Quantity TY (for current year) that is:
 
QTY TY = CALCULATE(sum('Merge_Table'[Quantity]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year]) && 'Date'[WeekNumber] = Max('Date'[WeekNumber]) ))
 
And another measure for QTY LY (For last year) that is:
 
QTY LY = CALCULATE(sum('Merge_Table'[Quantity]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year])-1 && 'Date'[WeekNumber] = Max('Date'[WeekNumber])))
 
The problem is that the QTY LY is returning the wrong week last year. I either need it to be 1 week forward or 1 week backwards and I won't know the answer until I can try both options.
 
Can someone help me here?
 
 
 
 

3 Replies