Sum of average in Spotfire calculated column - spotfire

I am averaging a calculated column to show on a visualisation but my results are not what I want.
Exploration wells Discoveries made
0.10 0
0.87 0.32
0.51 0
0.35 0
0.51 0
I am calculating the success rate using a simple expression
[Discoveries made] / [Exploration Wells]
But when I use the Avg aggregate in the visual Spotfire averages the Expression row by row rather than taking the average of the sum (for each year lets say)
So instead of getting 13.5% I get 7.4%
Is there a workaround for this one?
Thanks.
Here's my summary table
I am looking to get the division of the sums for[Discoveries (net)] and [Exploration Wells (net), which for this year would be 2.65/7.71=0.34
Instead I am getting 0.29
My raw data table looks like that:
That's because Spotfire calculates the division on a row by row basis and provides me with the Avg of the calculated column (0.29)
Any ideas?
Thanks

#Mourst- I calculated success rate which is [Discoveries] / [Exploration Wells] with the raw data provided. I am getting 0.34.
Not sure as why you are getting 0.29. Could you post more details as how you are calculating?
Here are the output tables:

Related

Building a sum in a for loop from a dataset

I have a dataset with two columns, Earning and Inflation_rate
Assuming the Dataset looks like this
0 Earning Inflation_rate
1 10000 0.00
2 12000 0.12
3 13000 0.13
I need to see how much it has built up over the course of these years, the formula is
(Income build until last year x inflation rate) + (first year earning/75)
For Year 1 that would be:
( 0 x 0.00 ) + (10000/75)
For Year 2 that would be:
(133 x 0.12) + (12000/75)
My code is the following:
y=int(input("Please enter the number of years of contribution: "))
income_built=0
divide=75
for i in range(1,y+1):
income_built=(income_built*df['Inflation_rate'].iloc[i-1,i])+(df['Earning'].iloc[i-1,i])/divide
print(int(income_built))
And I get the error
IndexingError: Too many indexers
How can I solve this ? Thank you!
The error is coming from your use of df['Inflation_rate'].iloc[i-1,i] and df['Earning'].iloc[i-1,i].
Pandas has a number of different ways of accessing values in a df, but the two most used are loc and iloc, both of which are explained well here.
I am slightly unclear about the formula you're trying to use. But I think if df['Inflation_rate'].iloc[i-1,i] is changed to df.loc[i-1,'Inflation_rate'] and df['Earning'].iloc[i-1,i] is changed to df.loc[i-1,'Earning', the error should dissappear.

Return three largest values from distribution in one formula

Suppose I have the following datapoints. I would like to extract the cumulative percentage distribution of this set of the three largest values.
So first step would be to transform to 100% distribution and secondly summarise the three largest values of the new distribution.
Data
0.00
1.35
11.05
24.85
37.85
15.40
6.95
1.65
0.25
I can calculate the individual percentage point with a simple datapoint / sum of datapoints per row and use =LARGE 1,2,3 on the new column to sum up the values. However, the challenge is to make all calculations in a single cell and just return just the final value.
In this case, the target value would be: 0.2494 + 0.3804 + 0.1548 = 0.7849 or 78.48%
Thanks for the help
Wrap a LARGE in SUMPRODUCT:
=SUMPRODUCT(LARGE(A2:A10,{1,2,3}))/SUM(A2:A10)

Function for finding duration where wave height <3m where time is between 5:00am and 6:00PM

I am trying to find duration for time where wave height is under 3m and time period is between 5:00am and 6:00pm. Trying to find this duration for a month of tidal data.
I have raw data for wave height and timestamps when it is high and low.
eg.
Timestamp Wave_Height
1/01/2022 3:16 0.68
1/01/2022 9:37 6.62
1/01/2022 16:14 1.07
1/01/2022 21:54 5.37
2/01/2022 4:06 0.59
etc…
So far I have got linear interpolation to find points where wave height=3. I am struggling to get a function to find the durations for my limits on time.
Included a picture to explain
Graph of wave data over time
The timestamps occur over different days in the month so difference between times must consider the changed dates in some cases(see rev 2 errors ####### where errors occur for changing of dates)
rev 2 error
The following should work. I have added some columns to avoid complicated formulas.
interpolate when the wave_height = 3 (column G)
add column H which is True when wave_height increases and False if it decreases (at the time in column G):
so cell H6 = F7<3 gives TRUE
add column E to limit the time window to 5:00-18:00.
E7 is =IF(D7<$G$2;$G$2;IF(D7>$H$2;$H$2;D7))
Added column I to calculate the time during wich wave_height < 3. The sum of that column is what you need.
I8 is =H8*(G8-E7)+NOT(H8)*(D8-G8)

Multiple part of a sum

I am trying to add sales from 5 days, each day a new column. I want to then take the first $50,000 and multiply by a percent, then 50-70k and multiply by another percent. Is this possible and what formula would I use?
Please correct me if it's not something you want. Assume you're calculating some sort of commission on the basis of sales at progressive rates: 35% on the first $50,000, 40% on the next $20,000 and 50% on the remaining.
Mathematically, the answer to your example should be $40,500 and here's the breakdown:
This Excel formula gives the expected amount, referencing cell 'M2' as the total sales:
=IF(M2<=50000,M2*0.35,IF(M2<=70000,17500+(M2-50000)*0.4,17500+8000+(M2-70000)*0.5))
The pseudocode to help you understand the formula more easily:
If totalSale <= $50,000, set commission = totalSale x 0.35
Else if totalSale <=70000, set commission = 17500 + (totalSale - 50000) x 0.40
Else set commission = 17500 + 8000 + (totalSale - 70000) x 0.50
You may wish to use more nested-if if there are more progressive rates. Check this out. Good luck!

Compare percentage value against decimal Excel

I am a bit stumped with this issue, I was wondering if anyone could suggest a solution. In Excel I have a table which looks like this:
1 2 3 4 5 Result Score
80% 85% 90% 95% 100% 92.5% 3.50
What I am trying to calculate is that proportional score, based on where the result falls within the preset decimal 1-5 score.
Thanks.
In your case where each increment is 5% you could use a simple calculation like
=MAX(0,F2-75%)*20
[where result is in F2]
....but assuming that you want to interpolate the score given potentially less linear values in your table try this formula where your table is in A1:E2
=LOOKUP(F2,A2:E2,A1:E1+(F2-A2:D2)*(B1:E1-A1:D1)/(B2:E2-A2:D2))
for linear interpolation this would be general formula, just name the ranges or replace with cell references:
= (perc - minperc) / (maxperc - minperc) * (maxscore - minscore) + minscore

Resources