# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
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? MVP

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 MVP

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
{"ft_lang_label":"__label__en","ft_lang_prob":0.9198345,"math_prob":0.8405485,"size":3042,"snap":"2021-04-2021-17","text_gpt3_token_len":818,"char_repetition_ratio":0.15668203,"word_repetition_ratio":0.022968197,"special_character_ratio":0.30341882,"punctuation_ratio":0.12960236,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.96904784,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-04-23T11:04:50Z\",\"WARC-Record-ID\":\"<urn:uuid:67f93a5a-3058-4e03-bffe-aec2b1ac1b6d>\",\"Content-Length\":\"368881\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:2da17cd3-3ee2-45cb-840a-9e70b29cb6d7>\",\"WARC-Concurrent-To\":\"<urn:uuid:f07b527c-9e93-4e68-8d90-18ce6e5007fb>\",\"WARC-IP-Address\":\"52.85.144.114\",\"WARC-Target-URI\":\"https://community.qlik.com/t5/QlikView-App-Dev/determine-the-number-of-months-to-calculate-average/td-p/236965\",\"WARC-Payload-Digest\":\"sha1:2Z4NOCPLBYTRAY4JZCRNNNT7K7RSSC2F\",\"WARC-Block-Digest\":\"sha1:TJWQCSN77F6T3Q63INK4DEHNDGL5E3WQ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-17/CC-MAIN-2021-17_segments_1618039617701.99_warc_CC-MAIN-20210423101141-20210423131141-00345.warc.gz\"}"}