Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

determine the number of months to calculate average

I have a chart (simple table) and a box of entry.

in the table, I have a 'date' and an average consumption.
the box of entry has a space to enter the number of months.

example:

Date: 09/09/09
if I type "2" in the box of entry (number of months)
need it to calculate the average consumption of the next two months from that date, in this case, it will calculate the average consumption of months 10 and 11, if I type "3" in the box of entry, it would calculate average consumption of months 10 , 11 and 12

understand???



what I put in the expression that calculates the average? I think it is that I have to change
And what I need to do more?

* Note: if I make only a average, without putting the number of months, it will make an average of everything, but I want to select the months that should be the average

can someone help me?

5 Replies
Not applicable
Author

can someone help me?

johnw
Champion III
Champion III

Is the user selecting one and only one Date? And your table looks like this?

Date, AverageConsumption
10/15/2010, 500
10/16/2020, 600

And you want the average of those averages? Maybe this:

avg({<Date={">=$(=date(monthstart(Date,1))) <=$(=date(monthstart(Date,1+NumberOfMonths)-1))"}>} AverageConsumption)

Not applicable
Author

I'm not an average, I need to do it ...
I'll try to explain again

I have a date and a box of entry, I'll find a average based on a value.

example:
01/02/10

if I put "4" on the box of entry, I'll get the average values of the next four months, in this case: I will have the average values of 2 to 6 months

johnw
Champion III
Champion III

What does your data look like? Do you have daily records like this? More than one record per day?

Date, Consumption
30/09/2010, 400
15/10/2010, 500
16/10/2010, 600
20/11/2010, 700
25/12/2010, 800

The user selects this?

Date = 09/09/09

The user types this in an input box?

Number of Months = 2

And you want the average consumption of months 10 and 11, since those are the two months following 9? Or did you want 9 and 10? Do you want an average of the raw data?

average = (500+600+700)/3 = 600

Or the average of the monthly averages?

average = ((500+600)/2 + 700)/2 = 625

If I'm not even close, please post some sample data, some sample selection by the user, what result you want to see, and why.

Not applicable
Author

I have several dice, but with different dates ... I am using a formula that shows only the most recent data (last entry of product), but there is other data (output of product).

gotta do what you said, had me fooled before...
in this example, the most recent data is from month "9" , if I type "2" for months in the inbox, it must parse the output value of 9 and 10, and make an average per day. ie sum the values of the month "9" and "10" and divide by 30 * the number of months in the case, divide by 2 months ...

the value is just the latest, it means I can have several values in one month ... I thought in divide the value (output of product) by the months, so I'll have the output value of each month, then depending on what is typed in the input box will take the correct months and make a average daily