Forum Discussion
Filter historic data dynamically by time periods
- Anonymous7 years ago
After a long struggle trying to solve this, I was able to find the solution on a StackOverflow post from Feb 1st 2018.
R. Sanchez's solution is the one that worked for me and fits perfectly the situation described on this post.
https://stackoverflow.com/questions/48564840/power-bi-dax-compute-latest-value-for-filtered-rows
Create a filtering measure similar to something like this:
__Show = VAR __table = SUMMARIZE(ALL(Table5),[Level],"__Min",MIN([Price])) VAR __level = MAX([Level]) VAR __price = MAX([Price]) RETURN IF(__price = MAXX(FILTER(__table,[Level] = __level),[__Min]),1,0)
For a different problem, but same concept. You would use something like MAX([LogDate]) instead of MIN([Price]).
- Anonymous7 years agoNot applicable
I implemented the measure but I have a inconvenient:
__Show = VAR __table = SUMMARIZE(ALL(CustomerPayments);CustomerPayments[PaymentDay];"__Max";MAX(CustomerPayments[LogDate])) VAR __level = MAX(CustomerPayments[PaymentDay]) VAR __logdate = MAX(CustomerPayments[LogDate]) RETURN IF(__logdate = MAXX(FILTER(__table;CustomerPayments[PaymentDay] = __level);[__Max]);1;0)
Keeping the data set the filter works.
But if in the data set registers new customers who pay in February 2019. The measure filters those with the highest LogDate. In this case excluding "Customer 4" because the maximum LogDate is "6/3/2019" and the LogDate of "Customer 4" is "1/2/2019". This customer must be included since he pays in the mentioned period.
I tried several ways, but I don't know how to perform the IF condition with a list.
- Anonymous7 years agoNot applicable
After a long struggle trying to solve this, I was able to find the solution on a StackOverflow post from Feb 1st 2018.
R. Sanchez's solution is the one that worked for me and fits perfectly the situation described on this post.
https://stackoverflow.com/questions/48564840/power-bi-dax-compute-latest-value-for-filtered-rows