Forum Discussion
Count only values with most recent date
- 4 years ago
Thanks, but this only returns the latest value overall. I need latest value by each account.
In case of Account1 that is Green, as date for it is Apr 01, for Account2 it is Yellow since it's on May 01 and for account 3 it is Red, only one value. - Anonymous4 years ago
Hi Krcmajster ,
You can create a measure as below to get it, please find the details in the attachment.
Count with most recent date = VAR _latestdate = CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[Account] ) ) RETURN COUNTX ( FILTER ( ALLEXCEPT ( 'Table', 'Table'[Account] ), 'Table'[Date] = _latestdate ), [Health] )Best Regards
Krcmajster , try if one of the two can help
DAXOnlyCount =
var vTable =
Maxx ( ALL ( 'Table' ), 'Table'[Date] )
return
CALCULATE(count('Table'[Health]), 'Table'[Date]=vTable /*[Latest] column*/)
or
DAXOnlyCount =
var vTable =
Maxx ( ALLexcept ( 'Table','Table'[Account] ), 'Table'[Date] )
return
CALCULATE(count('Table'[Health]), 'Table'[Date]=vTable /*[Latest] column*/)
Thanks, but this only returns the latest value overall. I need latest value by each account.
In case of Account1 that is Green, as date for it is Apr 01, for Account2 it is Yellow since it's on May 01 and for account 3 it is Red, only one value.
- Anonymous4 years agoNot applicable
Hi Krcmajster ,
You can create a measure as below to get it, please find the details in the attachment.
Count with most recent date = VAR _latestdate = CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[Account] ) ) RETURN COUNTX ( FILTER ( ALLEXCEPT ( 'Table', 'Table'[Account] ), 'Table'[Date] = _latestdate ), [Health] )Best Regards