Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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

7 Replies
sunny_talwar

May be something like this:

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

Not applicable
Author

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.

Not applicable
Author

Hi,

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

sunny_talwar

Do you not have Month as the dimension?

Not applicable
Author

Yes, month is a dimension.

Not applicable
Author

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.

sunny_talwar

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

Capture.PNG