I am attempting to reference a value in another row for a particular column of data in Spotfire. As an example, I would like to reference the sales month where the quantity of sales of bronze widgets was equal to the number of Gold Widgets. I've included a column below to show the data I need, "Month Where Bronze Sales = Gold Sales"
Sales Month Cumulative Bronze Widgets Cumulative Gold Widgets Month Where Bronze Sales = Gold Sales
1/1/2017 0 1 2/1/2017
2/1/2017 1 2 4/1/2017
3/1/2017 1 2 4/1/2017
4/1/2017 2 3 5/1/2017
5/1/2017 3 3 5/1/2017
6/1/2017 4 3 5/1/2017
I need to accomplish this with an expression without using a script or inserting another table. Is this possible? I've tried the following and other "Over" functions without success for "Month Where Bronze Sales = Gold Sales"
Case When Max([Cumulative Bronze Widgets]) over ([Sales Month])= [Cumulative Gold Widgets] Then Max([Sales Month]) Over ([Cumulative Bronze Widgets]) else NULL End
Spotfire supports getting data from another rows through OVER
formulas. That requires a common value in the SAME COLUMN of the current row and the one where you get the data from.
You need to match values in different columns, so OVER
won't work for you.
You can try some workarounds:
Cumulative Bronze Widgets
This works if you expect only a few numbers of Cumulative Bronze Widgets
:
Min(IF([Cumulative Bronze Widgets]=1,[Sales Month],Null))
Min(IF([Cumulative Bronze Widgets]=2,[Sales Month],Null))
Case When [Cumulative Gold Widgets] then [Cumulative Bronze Widgets - 1]
When [Cumulative Gold Widgets] then [Cumulative Bronze Widgets - 1]
....
End
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.