Referencing the previous row in Spotfire and a value in another column - spotfire

I'm trying to do something that is very simple to do in Excel, but seems very tricky in Spotfire:
Imagine you have the following table:
A
1: 10
2: 15
3: 20
... and you want to produce the following:
A B
1: 10 10
2: 15 25
3: 20 45
In other words, add the current value of A to the previous value of B. If this was Excel, the formula in cell B3 would be = A3 + B2... However, I'm not in Excel, I'm using Spotfire... :) Any thoughts?
NB: If it makes any difference to the answer at all, I will need to use the Intersect() function in conjunction with this, as there is a categorical column to factor in as well.

Hope this helps, I have considered the first column as ID
ID A B
1 10 10
2 15 25
3 20 45
If(Sum([A]) over (AllPrevious([ID])) is null,sum([A]) over ([ID]),Sum([A]) over (AllPrevious([ID])))

Related

count and sum function not properly working

I am working in excel and for some reason my sum or count function is not working properly. Or, perhaps I am not using the correct function or in the right way.
A B C D E F G H
February Max March Max
1 28
2
3
4
5
7
11
15
17
19
22
23
25
IF(SUM(A:A>0),28,"")
IF(SUM(E:E>0),31,"")
I have the above columns, I want the Max columns to show a specific number only if there is data in their respective month column. February has data, so it shows 28. March does not have any data so it shows no max. I need to look at the entire column or at least a large area (row 2 to row 2000).
The issue I am having is that if I do not have a value in the first row, but do have values in later rows, the sum or count function will to recognize that and will return zero.
A B
February Max
3
4
5
7
11
15
17
19
22
23
25
IF(SUM(A:A>0),28,"")
I have tried both sum and count functions, neither are giving me the results I want. I have also tried making >= 1. I found from StackExchange that someone was having a similar problem and a solution was to change the cell format to a number. That did not work either. Any suggestions?
Per my comment, you could use COUNTA() which checks if a cell is blank.
While it doesn't answer the technical reason SUM/COUNT isn't working, it should work for your intended purposes.
=IF(COUNTA(A:A)>0,28,"")

Compare cell in excel

i have some data like below in one column.
Value
-----
A#show
20
20
B#show
20
25
30
C#show
10
10
10
10
D#show
10
E#show
10
20
I want to compare the values between the cell where the last string is "show" and if there is only one then no comparison.
Value Comparison
----------------------
A#show Same
20
20
B#show different
20
25
30
C#show same
10
10
10
10
D#show only one
10
E#show different
10
20
I think it's can be possible using a VBA script
It's a bit unclear what you're trying to compare between values. However, there is a way to do this without VBA.
1) In the Second Column, create a "Header" column which names which header each value belongs to. The first entry would just be A#show, but then the following would be:
=IFERROR(IF(A2*1>0,B1),B2)
2) In the third column, you can utilize countif to see if the header has more than 2 entries (indicating it has a comparison). Here is where you can apply whatever comparative metric you'd like. If it's something unformulaic, just use a pivot table with the 3 columns.

Finding the right function in Excel to calculate

I have data like this:
A: B: C:
1: 4-jan-16 117 85
2: 11-jan-16 58 11
3: 18-jan-16 101 98
...
and so on up to 2-jan-17.
I need to calculate the difference between b1-c1, b2-c1 for each month (c1=85=Jan, c2=111=Feb, c3=98=March).
Then I need to take the difference of every week and ^2
I have no clue on how to go about it, I have looked up many function just not sure which would do the trick. Please feel free to ask for additional details...
UPDATE
outcome should be (add a column D)
A: B: C: D:
1: 4-jan-16 117 85 =b1-c1
2: 11-jan-16 58 11 =b2-c1
3: 18-jan-16 101 98 =b3-c1
4: 25-jan-16 110 10 =b4-c1
5: 1-Feb-16 52 =b5-c2
For the column B, I used the following (have 2 sheets one called BE, the other sheet1)
=AVERAGEIFS('BE'!$H$157:$H$208,'BE'!$B$157:$B$208,">="&A7,'BE'!$B$157:$B$208,"<="&EOMONTH(Sheet1!A7,0))
Was wondering if I could use something like that to calculate the difference for every week in column D
In D1 use the following and copy down.
=B1-INDEX($C$1:$C$4,MONTH(A1))
C1:C4 is the range for you month results This method will only word for the 1 year and needs your data start in January as that is month 1. The formula above also assumes your data start in row 1. If you Data does not start in row 1 then you would want to modify the formula as follows:
=B5-INDEX($C$5:$C$16,MONTH(A5)+row(A5)-(row($A$5)-1))
'This example assumes your data stated in row 5 and you had 12 month of monthly data in column C.

Rolling Time LookBack Calculation

I'm sorry if this has been answered. I've been searching around for awhile now.
I have a times series dataset that I need to perform calculations on based on the previous x time (last hour,day, etc).
My issues is that I don't know how to run these calculations since the time deltas are not standardized.
Example:
Column A - Time (in seconds lets say)
Column B - Value
Time Value Result(5)
01 3 0
02 5 3
04 4 8
07 8 9
09 6 12
13 4 6
14 4 10
15 1 8
22 9 0
33 7 0
How could I return the Result(5) column by summing the last 5 seconds from that one instance (row) (not including it)?
Thank you.
EDIT:
To clear up what I'm trying to do:
1) Find the previous 5 secs of data using column A and return that range of rows
2) Using that range of rows for the 5 previous secs, sum column B
3) Output in Column C (formula)
The following formula should do what you need (paste into C2 and drag down):
=SUMIFS($B$2:$B$11,$A$2:$A$11,">="&A2-5,$A$2:$A$11,"<"&A2)
Where YourTime is the time in the row you wish to look back and sum over.
I've tested and it works for the data you provided - expand the ranges as appropriate.

Excel: Find the minimal value in a column

An Excel table consists of two columns (e.g., A1:B5):
0 10
1 20
3 30
2 20
1 59
I need to get the minimal value in column B for which the corresponding value in column A is greater than zero. In the above example it should be 20.
I tried using various combinations of INDEX(), MIN(), IF(), ROW(), array formulas, etc. - but I just can't figure out how to do it. :-( Any help would be appreciated.
Grsm almost had it
if you enter the following formula in C1 as an array (Ctrl+Shift+End)
=MIN(IF(A1:A5>0,B1:B5))
That should do the trick.
I think you have to make an extra column..
A B C D
0 10 false 20
1 20 20
3 30 30
2 40 40
1 50 50
column C : =IF(A1>0;B1)
cell D1: =MIN(C1:C5)
You need to do it in 2 stages
First use the MIN function to find the minimum
Then take that answer and use the LOOKUP function to select the row and column that you need.
Check the "Minimum And Maximum Values In A Range" example in http://www.cpearson.com/Excel/excelF.htm (you can download the same as well from the same section)
HTH
This is not identical, but very similar: Excel VBA - Find minimum of list of values?

Resources