I want to write a function that gets a List of double values and a value for the variance as parameters and returns an adjusted List.
List<double> adjustTimeSeriesAsForecast(List<double> ts, double variance) {...}
This adjusted List should differ slightly or strongly from the original List, depending on the variance passed. However, the differences should be both above and below the original List, so that the mean percentage error (MPE) between the Lists remains the same and only the mean absolute percentage error (MAPE) changes. The returned List should look like a forecast.
With this function I want to test a system for stability, which gets a forecasted time series list for weather as input parameter.
How can I adjust a List of real weather data to look like a forecast?
Related
Above is a matrix in PowerBI that displays the amount and target amount for various divisions. I want to calculate the different between actual amount and target amount and display it in a third column in the matrix. I tried creating a column that calculates the difference between these two columns in the data table. But the data displayed in the matrix is not what I wish for it to be. I want the matrix to display the difference between the target and actual amount based on the values in the matrix only (which are derived based on certain filters applied). I do not want to get the difference of all the values in the dataset.
I am completely new to PowerBI and any help for the same would be highly appreciated.
Simply, use calculate. The value is the result of the expression evaluated in a modified filter context. That means in your current filter/row context.
diff = calculate([Target] - [Amount])
I am averaging a number, grouped by week inside of Google Data Studio, and i am averaging the same numbers grouped by week inside of Big query however the output is slightly different.
Overall Score
AVG(table.score) OVER (PARTITION BY Weeknum) as OverallScore
The datasource is a list of scores, along with a date. I am averaging this inside DS using the aggregate function within the metric, and using the Time dimension ISO Year Week.
The purpose of this is to have one set of numbers hard coded, whilst the other line is used to filter to different departments, keeping the original "overall" score present to be used as a benchmark.
Exporting my table into excel, i can average it filtered by week 3 (See below) and i it returns 19.59 as well. Meaning, the avg aggregate function inside Datastudio is the same as excel. Also, i can query the table using the below, which rules out an averaging difference inside bigquery. However when i place overall score into the graph below i get slightly different numbers for the overall score..
SELECT avg(overallscore) FROM `dbo.table` where weeknum = '2018 3'
Output = 19.59
Does anyone have an idea what may be causing this?
When you open the report, you should be able to see the query it runs in your query history in Big Query. Check that it's using the same formula as sometimes it uses approximate aggregates.
I’m having trouble understanding if Spotfire allows for conditional computations between arbitrary rows containing numerical data repeated over data groups. I could not find anything to cue me onto a right solution.
Context (simplified): I have data from a sensor reporting state of a process and this data is grouped into bursts/groups representing a measurement taking several minutes each.
Within each burst the sensor is measuring a signal and if a predefined feature (signal shape) was detected the sensor outputs some calculated value, V quantifying this feature and also reports a RunTime at which this happened.
So in essence I have three columns: Burst number, a set of RTs within this burst and Values associated with these RTs.
I need to add a calculated column to do a ratio of Values for rows where RT is equal to a specific number, let’s say 1.89 and 2.76.
The high level logic would be:
If a Value exists at 1.89 Run Time and a Value exists at 2.76 Run Time then compute the ratio of these values. Repeat for every Burst.
I understand I can repeat the computation over groups using OVER operator but I’m struggling with logic within each group...
Any tips would be appreciated.
Many thanks!
The first thing you need to do here is apply an order to your dataset. I assume the sample data is complete and encompasses the cases in your real data, thus, we create a calculated column:
RowID() as [ROWID]
Once this is done, we can create a calculated column which will compute your ratio over it's respective groups. Just a note, your B4 example is incorrect compared to the other groups. That is, you have your numerator and denominator reversed.
If(([RT]=1.89) or ([RT]=2.76),[Value] / Max([Value]) OVER (Intersect([Burst],Previous([ROWID]))))
Breaking this down...
If(([RT]=1.89) or ([RT]=2.76), limits the rows to those where the RT = 1.89 or 2.76.
Next comes the evaluation if the above condition is TRUE
[Value] / Max([Value]) OVER (Intersect([Burst],Previous([ROWID])))) This takes the value for the row and divides it by the Max([Value]) over the grouping of [Burst] and AllPrevious([ROWID]). This is noted by the Intersect() function. So, the denominator will always be the previous value for the grouping. Note that Max() was a simple aggregate used, but any should do for this case since we are only expecting a single value. All Over() functions require and aggregate to limit the result set to a single row.
RESULTS
I am working on creating a price list that uses calculated values to determine the price based on cost of good sold, area, and a few other things for some items.
There are different formulas used depending on the item type.
For example, prints would be calculated with an AREA multiplier type using the equation [#Multiplier]*[#Area] (referencing formatted table values, but they could also be typical references (f2*g2 for example)
So my question is, how could I set it so that a lookup of the multiplier type will reference a table that has the formula needed for that calculation.
I figured something like vlookup, but that either displays the equation itself, not the result, or doesnt work at all.
Currently, I have a big IF statement that works, but is a pain if I want to change the formula.
=MROUND(IF([#Mtype]='Multipliers 2'!$V$4,'Multipliers2'!W4,IF([#Mtype]='Multipliers 2'!$V$3,[#Multiplier]*[#Area]+40,IF([#Mtype]='Multipliers 2'!$V$5,2*[#[Cost of Goods]]+[#Multiplier], IF([#Mtype]='Multipliers 2'!$V$6,[#Area]*[#[Cost of Goods]]*[#Multiplier],[#Multiplier])))),0.5)
To Clarify, each product will have a multiplier type, along with data associated with the product that will be used for calculations:
So if I mark a product to use calculation A, the program should go look in a formula table, figure out what Calculation A is and then use those values to determine the result. If Calculation A = (Multiplier + 2*cost of goods sold), then it will look up the value in the multiplier column and add it to 2 x COGS.
Calculation B may be Multiplier * COGS and so on.
A problem I had last time I tried this a while ago was that even if I were to get the value to return some sort of result, I couldn't get the reference to change properly to correspond to the required row.
The data above is a small sample of what I'd be doing. Each product is part of a product type which has multiple variations in size, etc. So each product would reference a multiplier table which is used to calculate the final price, so if I want to change the prices for the entire group, all I'd have to do is change the value in the multiplier table, or the equation, and every corresponding product adjust accordingly.
The mtype would be controlled by the multiplier table. So I would like to set it so that if a particular mtype is used, the final calculation in the Price column will be determined by the formula listed.
I am looking for some help regarding ranking. My spreadsheet has columns labeled as follows:
Tickers
P/E Rate of Change
P/B Rate of Change
Dividend Yield Rate of Change
P/Sales Rate of Change
I am looking to come up with a composite ranking that takes into account a tickers relative rank within each rate of change category. I tried this first by creating an additional 4 columns and using the formula as follows:
IFERROR(RANK(D4,$D:$D,1),"")
I believe this gives me a rank for the corresponding rate of change. However, for those cells that have either a blank or an error I want to use a median in calculating the tickers rank. I was then going to sum the ranks in another column to come up with my final ranking but that doesn't seem to be calculating correctly as I have blank rows returning rankings that don't make sense.
I think you are almost there.
For one column I would change what you have to
=IFERROR(RANK(D4,$D:$D,1),MEDIAN($D:$D))
Then simply expand to add all ranks together
=IFERROR(RANK(A4,$A:$A,1),MEDIAN($D:$D))
+IFERROR(RANK(B4,$B:$B,1),MEDIAN($D:$D))
+IFERROR(RANK(C4,$C:$C,1),MEDIAN($D:$D))
+IFERROR(RANK(D4,$D:$D,1),MEDIAN($D:$D))
+IFERROR(RANK(E4,$E:$E,1),MEDIAN($D:$D))
To avoid potentially large numbers you could use an average (same resulting rank, but potentially easier to understand) by slightly changing the formula to:
=(IFERROR(RANK(A4,$A:$A,1),MEDIAN($D:$D))
+IFERROR(RANK(B4,$B:$B,1),MEDIAN($D:$D))
+IFERROR(RANK(C4,$C:$C,1),MEDIAN($D:$D))
+IFERROR(RANK(D4,$D:$D,1),MEDIAN($D:$D))
+IFERROR(RANK(E4,$E:$E,1),MEDIAN($D:$D)))/5