Spotfire - Calculated column based on values in another column in Spotfire - calculated-columns

I just started using Spotfire and I am having a bit of a tough time figuring out how to create a particular calculated column, I need your help please.
Here's a sample of the data I'm working with and the calculated column (NewCol) with the results :
Table
Each Portfolio is related to another one "Attached_portfolio" except those with the value "O" in the "Porxy" column which are called portfolio model.
For all Portfolio with "N" in the column "Proxy" and for each "Label", all I want to do is to :
Sum the amount value (column "Amount") with the amount value of the attached portfolio in the NewCol.
For all Portfolio with "O" in the column "Proxy" and for each "Label", all I want to do is to :
Keep the same amount value in the NewCol
Thank you in advanced for your help.

Calc Col 2 is what you want. To get this to work, I needed an intermediate column (probably due to how Spotfire evaluates If/Case statements. The first formula is Sum([Amount]) OVER ([Label]). The second formula is case when [Proxy]="O" then [Amount] else [Calc Col] end
The first one sums all values over label. Than's how you end up with 800. It is 700 + 100. The second column just tells it when to use that vs the regular amount. Combining these two is when spotfire evaluated the "O" rows together, then when it sums over the Label, those are removed from the pool, so the sum doesn't work correctly.

Related

excel look for same value and calculate value from next column

I have the following table, named ART_NR, It has number values in it, i need a function which looks for the same values in that column and calculates it accordingly for the column MENGE.
So it looks on column ART_NR for the same numbers and then calculates all the values together on the column MENGE. So if ART_NR has the value "1" lets say 10 times, it calculates on the column MENGE how much correspondes to ART_NR "1".
I left a picture as a example cause im having a bit of a hard time explaining it, but basically i need it to to calculate everything from the same value of ART_NR from the table MENGE

How to do lookups in Excel with multiple criteria

I have a question. I'm collecting social media statistics (likes, shares, comments, etc.), and one thing that I'm trying to do is get Excel to tell me the date that the largest number of hits occurred, what post it was on, and what type it was.
I'm part of the way there--I can get Excel to tell me what the highest number is (MAX, easy!), but I can't get it to lock in the date properly.
The way I've got it set up is: there's a single row for each day of the month, with the dates in column A, and additional columns for the types of engagements I'm tracking. At the very bottom of the table is a row with all the MAX values from each column (so in other words, column B will have Likes, column C is shares, and so on, so I can enter a new value for each analytic every day.
Essentially, what I'm trying to do is get Excel to do this, in order:
Look along the row with all the MAX values to find the highest value;
Look up above that (same column) into the data rows until it finds that MAX value;
Take note of the row where it found that MAX value, and return the value of the date from Column A
Make sense? I've got a formula set up with INDEX and MATCH, but while it is giving me the correct numbers for the top value and what type of analytic it is, I can't seem to get the correct date (what it looks like it's doing is counting the columns from left until it finds the value for #2, then counting that number of rows down).
Can anyone help?
You can do this by nesting MAX, MATCH and INDEX
Mockup of your data
The Formula
=INDEX(Table1[Date], MATCH(MAX(Table1[#Totals]), INDEX(Table1, , MATCH(MAX(Table1[#Totals]), Table1[#Totals], 0) ), 0 ) )
Explanation of the Formula
Of course, you don't have to use a Table. A formula for the same data, without Structured References
=INDEX(Sheet1!$K$2:$K$10, MATCH(MAX(Sheet1!$K$11:$P$11), INDEX(Sheet1!$K$2:$P$10, , MATCH(MAX(Sheet1!$K$11:$P$11), Sheet1!$K$11:$P$11, 0) ), 0 ) )

Climate: Calculate Consecutive Days of Rain

I have a data column rainfall, and a column is on that date;
I intend to extract Consecutive Days of Rain from it in a separate column.
With the formula below, I extracted Consecutive :
columnF=IF(B2>0,SUM(F1)+1,0)
But the result is in a column and I can not separate them like in attached picture (see desired result).
If we want to extract the continuity of rainfall in a separate column
How to do?
My result:
Desired result:
Following from Ted D's comment... a possible formula for the second helper column would be (in cell G2):
=IF(F2=0,0,MATCH(0,F3:F999,0)-1+F2)
This looks for the first 0 in the counter column (F) beneath our row (looking around 1000 rows down - that 999 can be changed as appropriate). We use that plus our current counter to give us the size of the block.
From there, we can make the columns with the dx1day etc. titles and populate them with the formula:
=IF($G2=VALUE(SUBSTITUTE(MID(H$1,3,999),"day","")),$F2,"")
This is parsing the number from dx1day at the top of the column (in this case H) (if you did it with just numbers and a custom format you could save that bit*). We then check if the current "block size" value (in column G) is the same as that in the header. If it is we copy the counter value (from column F), otherwise blank.
You can get away from this second helper column by replacing the $G2 with (IF($F2=0,0,MATCH(0,$F3:$F999,0)-1+$F2)) - but if makes it a bit more of a headache to understand (and debug :-)
*the way for this is to do custom format with the "Type" being "dx"0"day"... then the formula becomes =IF($G2=H$1,$F2,"") or =IF((IF($F2=0,0,MATCH(0,$F3:$F999,0)-1+$F2))=H$1,$F2,"") for the no-second-helper-column version

Use RANK function for cell range based on criteria in separate cell range

I have a question regarding the RANK function in MS Excel 2010. I have a large worksheet whose rows I want to rank based on the values in a column. These values can be positive or negative. I found helpful advice here which explains how to rank the values in a column while excluding all values that equal zero from the ranking and the ranking count. They use the following formula:
IF(O24<0, RANK(O24,$O$24:$O$29) - COUNTIF($O$24:$O$29,0), IF(O24=0, "", RANK(O24,$O$24:$O$29)))
This works great, but it would be even better if I could rank the values only if a corresponding value in the same row but a different column meets certain criteria.
Is something like this possible and how would I do it? How would I update the example formula above to make the change work? Thank you very much in advance for your help.
P.S.: I tried putting in a table but it didn't really work, sorry...
You can use COUNTIFS function to rank based on a condition in another column, e.g. this formula in row 24 copied down [edited to include extra IF)
=IF(O24=0,"",IF(N24="x",COUNTIFS(O$24:O$29,">"&O24,O$24:O$29,"<>0",N$24:N$29,"x")+1,""))
That will rank high to low where column N = "x", ignoring zero values
See this example columns N and O contain random values - press F9 to re-generate new random values and formula results in column Q will change accordingly
It is certainly possible to keep creating more complex formulas whenever you're adding new criteria on which to rank. However by creating intermediary columns with single-step formulas, you'll make your spreadsheet easier to comprehend and easier to add new criteria or edit the existing.
My suggestion is to create a column that excludes the zero's (let's assume this is in column P): =IF(O24 = 0, "", O24)
Then in column R, to eliminate negative values (this step is unnecessary, but your original formula does something similar): =IF(P24 = "", "", P24 - MIN(0, MIN($O$24:$O$29)))
Now in column S, add your newest criteria: =IF(OR(R24="", [enter newest criteria here]), "", R24)
Finally, column T performs the ranking of only the selected rows: =IF(S24="", "", RANK(S24, S$24:S$29))
If exposing columns P, R and S is bothersome, you can always hide them.
A rewording of the answer from barry houdini, using table format.
Value_Col is the column with the values to rank. Group_Column is the column with the group by values, to rank within groups
=COUNTIFS([Value_Col], ">"&[#[Value]], [Value_Column],"<>0", [Group_Column], [#[Group]]) +1

VBA Code to sum values in one column based on the value in another column in excel

I am a VBA Newbie and a first timer on this forum - I have followed all the instructions on the "how to ask" page - I may have missed something please do advise
I am creating an EV report for project tracking based on the following column headers (showing only a few for brevity)
"TaskName" "Status" "BaselineStart" "BaselineFinish" "BaselineEffort"
need to sum up the values in the BaselineEffort column in 7 day increments after checking if the value in the BaselineFinish column is less than or equal to the 7th day value
I believe the answer lies in using arrays, but need handholding with that concept to understand how it works
Pivot and Excel formulas dont work for me because the table is dynamic while the report is static and I need to remove user intervention in creating the report
Thanks in advance
say that the criteria column starts in A1 and the colume to be summed starts in B1
do while not isempty(range("a1").offset(x,0))
if range("a1").offset(x,0) = SomeValue then
sum = sum + range("a1").offset(x,0)
end if
x = x + 1
loop
this code will run until it has looked at each item in column A, and add the value in column B to a sum I called "sum" if the value in column A equals "SomeValue." I doubt you can actually use the variable name "sum."
I hope that's useful.

Resources