Show Last Customer for a stock item, but make it a filterable dimension
Hi! I have a client request to show a table of info about stock items. One of the things they want to see is the last transaction date, The last customer, and the Qty of that transaction.
I can easily get all these by using the FirstSortedValue function, but the trick is they want to be able to click on the customer to filter the app for that customer to review their activity.
I have tried a few variations of AGGR but can't seem to get this to work. My latest attempt is to use this dimension expression:
=Aggr(Maxstring(
Aggr(
FirstSortedValue(Customer,-Date+rand())
,StockItem))
,Customer)
This shows an extra line with a blank in this field. Also, if you click on the customer it selects a different one. Very odd behavior. For reference, here is a simple load statement to illustrate the issue: