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
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.
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