Forum Discussion
Calculating weekly COVID reported cases.
- 6 years ago
Hi Anonymous
Try these measures, and the data you marked also calculated correctly.
TotalCasesConfirmed = CALCULATE(SUM(COVID[Confirmed]),LASTDATE('Calendar'[Date])) CasesPerDay = VAR Varcasesperday = [TotalCasesConfirmed] - CALCULATE([TotalCasesConfirmed],DATEADD('Calendar'[Date],-1,DAY)) RETURN IF([TotalCasesConfirmed]=BLANK(),BLANK(),Varcasesperday) CasesPerWeek = VAR Varcasesperweek = [TotalCasesConfirmed] - CALCULATE([TotalCasesConfirmed], DATEADD('Calendar'[Date],-7,DAY)) RETURN IF([TotalCasesConfirmed]=BLANK(),BLANK(),Varcasesperweek)And the result:
Best Regards,
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous
Try these measures, and the data you marked also calculated correctly.
TotalCasesConfirmed = CALCULATE(SUM(COVID[Confirmed]),LASTDATE('Calendar'[Date]))
CasesPerDay =
VAR Varcasesperday = [TotalCasesConfirmed] - CALCULATE([TotalCasesConfirmed],DATEADD('Calendar'[Date],-1,DAY))
RETURN
IF([TotalCasesConfirmed]=BLANK(),BLANK(),Varcasesperday)
CasesPerWeek =
VAR Varcasesperweek = [TotalCasesConfirmed] - CALCULATE([TotalCasesConfirmed], DATEADD('Calendar'[Date],-7,DAY))
RETURN
IF([TotalCasesConfirmed]=BLANK(),BLANK(),Varcasesperweek)
And the result:
Best Regards,
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Great v-jingzhang ,you have made my day!! I figured out the issue I was having with my orginal measures was because I did not have that last bit of "LASTDATE('Calendar'[Date])" on the total Cases Confirmed measure
TotalCasesConfirmed = CALCULATE(SUM(COVID[Confirmed]),LASTDATE('Calendar'[Date]))
The measures you provided was the one I was looking for, it works perfectly fine and the weekly total of cases matches with the weekly accumulated cases.
Many thanks both of you v-jingzhang amitchandak to help me with this.
Have a good day!