7 Replies Latest reply: Jan 26, 2016 12:50 PM by Sunny Talwar

# Create an average of current month and previous month in same column.

I’m trying to create a measure that is the average of the current month and the previous month.   For example: if the sum(Sales) for Oct2015 is \$1,000 and the sum(Sales) for Nov2015 is \$2,000, I want value in this new column to be \$1,500 for Nov2015. Likewise, the values in this column for the previous month, October, will be the average of Oct/Sep…and the value for the September row will be avg(Sep/Aug), etc.

Is there a formula for Qliksense that will allow me to create this dimension in the table?  Might it have to be done in the script?  If so, how?

Thanks,   Dan

• ###### Re: Create an average of current month and previous month in same column.

May be something like this:

RangeAvg(Sum(Sales), Above(Sum(Sales)))

• ###### Re: Create an average of current month and previous month in same column.

Thanks for the quick response.  However, this formula just returns the same value for the month on the row...not the average of the two rows.

• ###### Re: Create an average of current month and previous month in same column.

Do you not have Month as the dimension?

• ###### Re: Create an average of current month and previous month in same column.

Yes, month is a dimension.

• ###### Re: Create an average of current month and previous month in same column.

Seems to be working perfectly in QlikView. Do you have an app you can share to help you do it in Qlik Sense

• ###### Re: Create an average of current month and previous month in same column.

Hi,

Try something like =RangeSum(Above(avg(Sales), 0, RowNo()))

• ###### Re: Create an average of current month and previous month in same column.

The values for November show 11, when it should be 12,356,419.  The value for October shows 13 when it should be 12,143,089.