Products | Versions |
---|---|
Spotfire Analyst | All Versions |
First and Last methods with navigations AllPrevious, AllNext and LastPeriods, such as First(Value) OVER AllPrevious(Category), should be calculated on the original data table row-ordering but was sometimes incorrectly calculated on the sorted result from the navigation instead.
Some aggregations (EXCLUDING: Sum, Product, Count, Min, Max, First, Last, Avg, Range, Percent) with a column method (such as Rank or DenseRank) as argument may have given incorrect results if combined with certain OVER expression navigations. For example: Q3(Rank(Column)) OVER Next(Column) .
Option 1:
If the sorted result from the navigation is wanted, then ValueForMax(Category, Value) OVER AllPrevious(Category) can be used instead, or LastValueForMax() can be used here if Last() was used before the upgrade.
Option 2:
While ValueForMax does exactly what is required. It has not been optimized for large hierarchies and might not have optimal performance, especially on larger hierarchies. Even if the amount of data is pretty small, the rank hierarchy with all previous is quite large. There is a workaround however that can be done using two calculated columns instead. First create a calculated column called "rankToUse" with the following definition or similar:
Max(CASE WHEN [mycolValue] IS NOT NULL THEN [Rank] ELSE NULL END) OVER (AllPrevious([Rank]))
This column will calculate the rank to use for a specific row by getting the largest rank where the mycolValue column is not null. In order to get the actual mycolValue value we need to add a second calculated column that will give the expected result:
Max(CASE WHEN [Rank]=[rankToUse] THEN [mycolValue] END) OVER ([rankToUse])
This is a fast way to compute the requested results like the earlier ValueForMax() method.