Forum Discussion
Caz_16
6 years agoHelper II
Max Value from Previous Week
Hello All, Goal: What I want to do is calculate the change in cases per week (not in a percentage), just a raw number that is the number of new cases from the previous week (current week - previo...
- 6 years ago
Hi Caz_16 ,
If you want to calculate the cases between current week and last week which based on current week, you can try this measure:
Change by week = VAR _Week = WEEKNUM ( TODAY (), 2 ) VAR thisweeknumber = CALCULATE ( SUM ( 'VDH-COVID-19-PublicUseDataset-Cases'[Total Cases] ), 'VDH-COVID-19-PublicUseDataset-Cases'[Week Number] = _Week ) VAR lastweeknumber = CALCULATE ( SUM ( 'VDH-COVID-19-PublicUseDataset-Cases'[Total Cases] ), 'VDH-COVID-19-PublicUseDataset-Cases'[Week Number] = _Week - 1 ) RETURN thisweeknumber - lastweeknumberBased on your dataset, it will get the result like this:
Best Regards,
Yingjie LiIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
v-yingjl
6 years agoCommunity Support
Hi Caz_16 ,
If you want to calculate the cases between current week and last week which based on current week, you can try this measure:
Change by week =
VAR _Week =
WEEKNUM ( TODAY (), 2 )
VAR thisweeknumber =
CALCULATE (
SUM ( 'VDH-COVID-19-PublicUseDataset-Cases'[Total Cases] ),
'VDH-COVID-19-PublicUseDataset-Cases'[Week Number] = _Week
)
VAR lastweeknumber =
CALCULATE (
SUM ( 'VDH-COVID-19-PublicUseDataset-Cases'[Total Cases] ),
'VDH-COVID-19-PublicUseDataset-Cases'[Week Number] = _Week - 1
)
RETURN
thisweeknumber - lastweeknumber
Based on your dataset, it will get the result like this:
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.