Forum Discussion
romina80
9 months agoFrequent Visitor
Calculate previous week values
Hello , I have the following table in Power Bi : Movement type Calendar week Actual PreviousWeek Net Growth 202452 50 Net Disconnections 202452 750 Net Connections 202452 ...
- 9 months ago
Hi romina80,
You can use below DAX logic to create new Calculated column
PreviousWeek = VAR CurrentMovement = 'Movements'[Movement type] VAR CurrentWeek = 'Movements'[Calendar week] VAR PreviousWeekNumber = CALCULATE(MAX('Movements'[Calendar week]), FILTER('Movements', 'Movements'[Calendar week] < CurrentWeek)) RETURN CALCULATE(MAX('Movements'[Actual]), FILTER('Movements', 'Movements'[Movement type] = CurrentMovement && 'Movements'[Calendar week] = PreviousWeekNumber ))Thanks,
If you found this solution helpful, please consider giving it a Like👍 and marking it as Accepted Solution✔. This helps improve visibility for others who may be encountering/facing same questions/issues.
ajaybabuinturi
9 months agoSuper User
Hi romina80,
You can use below DAX logic to create new Calculated column
PreviousWeek =
VAR CurrentMovement = 'Movements'[Movement type]
VAR CurrentWeek = 'Movements'[Calendar week]
VAR PreviousWeekNumber =
CALCULATE(MAX('Movements'[Calendar week]),
FILTER('Movements', 'Movements'[Calendar week] < CurrentWeek))
RETURN
CALCULATE(MAX('Movements'[Actual]),
FILTER('Movements',
'Movements'[Movement type] = CurrentMovement &&
'Movements'[Calendar week] = PreviousWeekNumber
))
Thanks,
If you found this solution helpful, please consider giving it a Like👍 and marking it as Accepted Solution✔. This helps improve visibility for others who may be encountering/facing same questions/issues.