Forum Discussion
Set a filter based on MAX
- 10 years ago
GilesWalker - Try switching your ALL to an ALLEXCEPT in order to preserve the Train ID context filter:
max = CALCULATE(MAX(Train_Movements[sequence]),ALLEXCEPT(Train_Movements,[Train id]))
konstantinos Greg_Deckler Please see the screenshot of the table Train-Movements:
The sequence column changes to represent how many stops the train made along its route. The max number in the sequence could be anything (3,4,8,9,13, etc...) This max number represents the final destination.
I changed my measure to be this:
max = CALCULATE(MAX(Train_Movements[sequence]),ALL(Train_Movements))
and the calculated column is:
IsMax = IF(Train_Movements[sequence]=[max],1,0)
This was the result I got:
It seems as though the forumla is picking the highest number in the sequence column (this case was 13). If you look at the above data Train 636 had a max of 10 in its sequence, 654 had a max of 4, 677 had a max of 5.
Thanks again for your efforts with helping on this.
Giles
GilesWalker - Try switching your ALL to an ALLEXCEPT in order to preserve the Train ID context filter:
max = CALCULATE(MAX(Train_Movements[sequence]),ALLEXCEPT(Train_Movements,[Train id]))