Forum Discussion

tulasi_pbi1988's avatar
6 years ago
Solved

Calculating Previous without Contiguous date column but having start date and end date of week

Hello,

 

I need help with the previous week's calculation. 

 

I have the data consists of the start date and end date of the week and fiscal week column. I didn't have any date column apart from the start date and end date. I want to calculate the previous week which works in different granularity levels.

Please check the below screenshot.

 

I have tried with calander table week number also but it didn't worked and I have used relationship between two table is both side.

This the present calculation I have used.

measure option1:
PrevWeekInvQty = CALCULATE(sum(Sheet1[ Inventory Qty]),FILTER(ALL(Sheet1),MAX(Sheet1[weeknum])=Sheet1[weeknum]+1))
measure option2:
PrevWeekInvQty = var currwk =SELECTEDVALUE('Calendar'[WeekSequenceNum])
var maxwk=CALCULATE(max('Calendar'[WeekSequenceNum]),ALL('Calendar'))
return
sumx(FILTER(ALL('Calendar'),
if(currwk=1,
'Calendar'[WeekSequenceNum]=maxwk,
'Calendar'[WeekSequenceNum]=currwk-1)),
[Total Invqty])
 
Option is working only for high level granularity only.
 
 
 

5 Replies