Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am looking to display the latest value in a aggregation. Currently I am using an aggregation have the following information:
=aggr(Sum([Sales]),Week)
Week | Sales |
2020/01 | 10 |
2020/02 | 12 |
2020/03 | 1 |
2020/04 | 9 |
2020/05 | 8 |
Now i want to have a KPI which display only the latest sale value from the aggregation showed above.
The formula that i tried, and was not working is:
= FirstSortedValue(aggr(Sum([Sales]),Week),-Week)
You could use something along the lines of:
Sum({< [Week] = {"=$(=MaxString(Week))"} >} Sales)
As far as I know, you can't use a text field for the sort_order portion of a FirstSortedValue() formula. You could work around this by creating a numeric/date week field instead of what appears to be a textual one.
The list of words appears already sorted whenever i put it in a plot or table. So if there anyway for me to query an specific element of the aggregation, that would be enough for me, even if it does not involve the FirstSortedValue() function.
You could use something along the lines of:
Sum({< [Week] = {"=$(=MaxString(Week))"} >} Sales)