Forum Discussion
murphm6
Helper II
3 years agoReturn blank value or max date allexcept?
Hi all, I have a table that shows customers and product combinations over the years. I'm trying to return the most up-to-date price for each customer-product combination. The table format is...
- Anonymous3 years ago
Hi murphm6 ,
Here are the steps you can follow:
1. Create calculated column.
Column = var _maxfromdate=MAXX(FILTER(ALL('Table'),'Table'[Cust]=EARLIER('Table'[Cust])&&'Table'[Product]=EARLIER('Table'[Product])),[From-Date]) var _maxtodate=MAXX(FILTER(ALL('Table'),'Table'[Cust]=EARLIER('Table'[Cust])&&'Table'[Product]=EARLIER('Table'[Product])&&'Table'[From-Date]=_maxfromdate),[To-Date]) return _maxtodate2. Result:
When the maximum date is empty:
Maximum date when data is available:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
amitchandak
Super User
3 years agomurphm6, a new column
maxx(filter(Table, [cust]=earlier([cust]) && [product] = earlier([product]) && not(isblank([to-Date])) ), [to-Date])
Earlier, I should have known Earlier: https://youtu.be/CVW6YwvHHi8
https://www.youtube.com/watch?v=cN8AO3_vmlY&t=17820s
murphm6
Helper II
3 years agoHey amitchandak , i tried this solution and it's still just taking the max date. For cust-prod combinations where there is a blank to-date, it's not returning a blank value