Forum Discussion
Anonymous
4 years agoNot applicable
Compare latest values
Hello,
I have a table like this
| Category | Week | Value |
| C1 | 1 | aaa |
| C1 | 2 | ccc |
| C2 | 1 | bbb |
How do I create a filter that sums the latest value per category?
(in this case that would mean bbb + ccc)
Thanks!
Anonymous
Please find the DAX as below
Latest Week Value = if( CALCULATE(max(Category[Week]),all(Category),Category[Category]=max(Category[Category]))=max(Category[Week]),sum(Category[Value]),0)Regards,Ritesh
4 Replies
- ribisht17Super User
Anonymous
Please find the DAX as below
Latest Week Value = if( CALCULATE(max(Category[Week]),all(Category),Category[Category]=max(Category[Category]))=max(Category[Week]),sum(Category[Value]),0)Regards,Ritesh- AnonymousNot applicable
What happens if the latest value is not the same as the maximum value?
- ribisht17Super User
Anonymous formula is as per the latest week value within the category, you want that only?
max(Category[Week]),all(Category),Category[Category]=max(Category[Category]))=max(Category[Week])
LHS > This will get you the Latest Week within category = RHS > This is at row level context, max is used to make it an aggregate otherwise it will give you the Category Week per row
- AnonymousNot applicable
Thank you so much for the help 🙂