Adi Lavy Posted August 14, 2020 Share Posted August 14, 2020 Hi all! I'm new to Spotfire and been trying to solve this problem.... In the following table there is sales data for two days in each week in each quarter. The value of sales for each of these days needs to be corrected by subtracting the value for the factor for that week. For example - 1st quarter, week1, Saturday has sales=20, I would like to subtract 3 (which is the value of the factor for that week). One important consideration is that this solution cannot assume that the number of observations is fixed. It could be that in the 3rd quarter there will be data for more than 2 weeks and more than 2 days in each week. I would appericiate any help!!! Link to comment Share on other sites More sharing options...
Fabian Duerr Posted August 14, 2020 Share Posted August 14, 2020 Step 1 is a simple IF Function: If([Day]="factor",[sales])Step 2 is to combine with anaggregation function (like FIRST, but MIN, MAX, AVG and so on would give same result...). Your group is Qrt and Week. Grouping/aggregation is done with an OVER function: First(If([Day]="factor",[sales])) OVER ([Qrt],[Week]) So here's the result (you only need Step 2): Now just subtract this column from sales column Link to comment Share on other sites More sharing options...
Adi Lavy Posted August 14, 2020 Author Share Posted August 14, 2020 Works like a charm! Thank you so much!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now