Forum Discussion
Filter minimum value per category within date range
- Anonymous3 years ago
Hi tim_mountford ,
Please try this measure.
Measure = var a=FILTER(ALLSELECTED('Table'),[Person_ID]=SELECTEDVALUE('Table'[Person_ID])&&[Attribute_type_ID]=SELECTEDVALUE('Table'[Attribute_type_ID])) var b=MINX(a,[Ordering]) return MAXX(FILTER(a,[Ordering]=b),[Attribute_value])Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Neeko, Anonymous
Thank you so much for your help! Unfortunately, I don't think your solution works. For the full date range I would want to display the values for each person with 'ordering' = 1. Whereas if I only look at data from 2015, the attribute 1 values with ordering = 1 for each person in the above example fall outside outside of the date range and I'd want to then show the values with ordering = 2.
So I'm not looking for the minimum value in the attribute_value column, but rather the value associated with the minimum ranking. This is because for attribute 1 for example, I'm looking for the highest value, for attribute 2 I'm looking for the lowest and for attribute 3 I might be looking for the value closest to their first visit.
Ideally the measure would be a flag that is 1 for the rows with the minimum ordering value in the date range and 0 otherwise, that way I can filter the matrix with Measure = 1.
Hi tim_mountford ,
Please try this measure.
Measure = var a=FILTER(ALLSELECTED('Table'),[Person_ID]=SELECTEDVALUE('Table'[Person_ID])&&[Attribute_type_ID]=SELECTEDVALUE('Table'[Attribute_type_ID]))
var b=MINX(a,[Ordering])
return MAXX(FILTER(a,[Ordering]=b),[Attribute_value])
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- tim_mountford3 years agoNew Member
Thank you so much Neeko! This is exactly what I was looking for 🙌