Forum Discussion
Anonymous
4 years agoNot applicable
Need help reset count
Hi All, I've tried to calculate the total infected and recovered users every month, the total recovered doesn't matter but the total infected when the same users are infected again after recovery th...
- 4 years ago
I'd recommend looking at whatever the last status was.
Try something like this:
CountInfected = VAR LastStatusDates = ADDCOLUMNS ( VALUES ( Summary[User] ), "@LastStatusDate", CALCULATE ( MAX ( Summary[Date] ) ) ) RETURN SUMX ( LastStatusDates, LOOKUPVALUE ( Summary[Infected], Summary[User], Summary[User], Summary[Date], [@LastStatusDate] ) )
parry2k
4 years agoSuper User
AlexisOlson got it. I missed that. Thanks for pointing that out.
Anonymous Here is a measure.
Total Infected =
VAR __table = TOPN ( 1, ALLSELECTED ( 'Table' ), CALCULATE ( MAX ( 'Table'[Date] ), VALUES ( 'Table'[User] ) ), DESC )
VAR __totalInfected =
CALCULATE (
SUM ( 'Table'[Infected] ),
KEEPFILTERS ( __table )
) -
CALCULATE (
SUM ( 'Table'[Recovered] ),
KEEPFILTERS ( __table )
)
RETURN IF ( __totalInfected > 0, __totalInfected )
Anonymous
4 years agoNot applicable
It works as required. Great Support. Thanks, parry2k