Forum Discussion
Filter Report by Max Date
- 9 years ago
Hi surajv3. One way you can do this is by going to the Data view and adding a new column that will indicate which row contains the max changed date by ID. Here's the column I used:
IsLatestChangedDateByID = TableName[ChangedDate] =
CALCULATE(
MAX(TableName[ChangedDate]),
FILTER(ALL(TableName), TableName[ID]=EARLIER(TableName[ID]))
)Using that will give you a True/False indicator that you can use in Filters, Slicers, etc.
Another way to get the same result is to use LASTNONBLANK instead of MAX:
IsLatestChangedDateByID = TableName[ChangedDate] = CALCULATE( LASTNONBLANK(TableName[ChangedDate], 1), FILTER(ALL(TableName), TableName[ID]=EARLIER(TableName[ID])) )
That's what I used at first, but then though the MAX solution is probably more intuitive. I only showed both so you know the options are there, and there are some cases where LASTNONBLANK will be more helpful than MAX.
Hi surajv3. One way you can do this is by going to the Data view and adding a new column that will indicate which row contains the max changed date by ID. Here's the column I used:
IsLatestChangedDateByID = TableName[ChangedDate] =
CALCULATE(
MAX(TableName[ChangedDate]),
FILTER(ALL(TableName), TableName[ID]=EARLIER(TableName[ID]))
)
Using that will give you a True/False indicator that you can use in Filters, Slicers, etc.
Another way to get the same result is to use LASTNONBLANK instead of MAX:
IsLatestChangedDateByID = TableName[ChangedDate] = CALCULATE( LASTNONBLANK(TableName[ChangedDate], 1), FILTER(ALL(TableName), TableName[ID]=EARLIER(TableName[ID])) )
That's what I used at first, but then though the MAX solution is probably more intuitive. I only showed both so you know the options are there, and there are some cases where LASTNONBLANK will be more helpful than MAX.
After several tries of finding the latest date grouped by customer, this was the one that worked. Thanks.