Forum Discussion
youconnect
6 years agoHelper I
Countrows last date
I have this table id state date 1 active 01/01/2020 1 reserved 05/01/2020 1 suspended 08/01/2020 1 sold 15/01/2020 2 active 02/01/2020 2 suspended 03/01/2020 2 ...
- 6 years ago
Hi youconnect ,
I am understanding your logic and have made the following calculation:
count_active_id = var last_active_date = CALCULATE(MAX(Sheet2[date]),FILTER(ALLEXCEPT(Sheet2,Sheet2[id],Sheet2[date]),Sheet2[state]="active")) var last_date = CALCULATE(MAX(Sheet2[date]),ALLEXCEPT(Sheet2,Sheet2[id])) return CALCULATE(COUNTROWS(FILTER(Sheet2,last_active_date=last_date)))Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
V-lianl-msft
6 years agoCommunity Support
Hi youconnect ,
I am understanding your logic and have made the following calculation:
count_active_id =
var last_active_date = CALCULATE(MAX(Sheet2[date]),FILTER(ALLEXCEPT(Sheet2,Sheet2[id],Sheet2[date]),Sheet2[state]="active"))
var last_date = CALCULATE(MAX(Sheet2[date]),ALLEXCEPT(Sheet2,Sheet2[id]))
return CALCULATE(COUNTROWS(FILTER(Sheet2,last_active_date=last_date)))
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
youconnect
6 years agoHelper I
Thanks V-lianl-msft it worked like a charm.
Another question: If I want only the records before 01-01-2020 how do that?