PDA

View Full Version : Show number of cases of the last date



RonaldLieuw
2020-02-04, 07:25 PM
Hi, I am trying to make a card in Power BI with the number of cases on the last day of the data set e.g

The card should show 17,238 - 2/3/2020.

I made a measure MaxDay = MAX(China[Date]), which shows the correct (last) date.
I made another measure LastValue and then filtered on MaxDay

LastValue = CALCULATE(SUM(China[Confirmed (new cases)]), FILTER('China', China[Date] = [MaxDay]))

I am still getting the Total value of the column [Confirmed (new cases)] 79,471 instead of 17,238.
Pbix file included.

Can some one help?

RonaldLieuw
2020-02-06, 08:21 PM
This is the solution:

LastValue3 = var maxdaychina = Calculate(Max(China[Date]),All(China))
return
CALCULATE(SUM(China[Confirmed (new cases)]), FILTER(China, China[Date] = maxdaychina))