Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
vikas_nandanwar
Creator II
Creator II

Cumulative Average and Sales for months

Hi,

I have below set of data consisting of Month and Inv

I want expression for Avg Inv(Calculated for reference as expected answer)

I want my month graph to show my avg inventory as highlighted in Avg Inv (Expression for)

      

    

MonthInvAvg InvExpression for
1-Jan-1664.9764.97Avg of Jan
1-Feb-1673.1769.07Avg of Jan, Feb
1-Mar-1677.4871.87Avg of Jan, Feb, Mar
1-Apr-1671.5671.8Avg of Jan, Feb, Mar, Apr
1-May-1673.5172.14Avg of Jan, Feb,  Mar, Apr, May
1-Jun-1673.6572.39Avg of Jan, Feb,  Mar, Apr, May, Jun
1-Jul-1679.2374.77Avg of Feb, Mar, Apr, May, Jun, Jul
1-Aug-1678.9675.73Avg of Mar, Apr, May, Jun, Jul, Aug
1-Sep-1679.7376.11Avg of Apr, May, Jun, Jul, Aug, Sep
1-Oct-1681.7277.8Avg of May, Jun, Jul, Aug, Sep, Oct
1-Nov-1676.0378.22Avg of Jun, Jul, Aug, Sep, Oct, Nov
1-Dec-1675.4678.52Avg of Jul, Aug, Sep, Oct, Nov, Dec
1-Jan-1770.6377.09Avg of , Aug, Sep, Oct, Nov, Dec, Jan
1-Feb-1776.1276.62Avg of , Sep, Oct, Nov, Dec, Jan, Feb
1-Mar-1777.7676.29Avg of Oct, Nov, Dec, Jan, Feb, Mar
1-Apr-177274.67Avg of Nov, Dec, Jan, Feb, Mar, Apr
1-May-1771.6873.94Avg of Dec, Jan, Feb, Mar, Apr, May
1-Jun-1772.5473.46Avg of Jan, Feb, Mar, Apr, May, Jun
1-Jul-1781.4675.26Avg of Feb, Mar, Apr, May, Jun, Jul
1-Aug-1777.1375.43Avg of Mar, Apr, May, Jun, Jul, Aug
1-Sep-1779.9475.79Avg of Apr, May, Jun, Jul, Aug, Sep
1-Oct-1780.2277.16Avg of May, Jun, Jul, Aug, Sep, Oct
1-Nov-1776.9478.04Avg of Jun, Jul, Aug, Sep, Oct, Nov
1-Dec-1776.0478.62Avg of Jul, Aug, Sep, Oct, Nov, Dec
1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

Can you add TOTAL to both the RowNo() functions like this:

RangeAvg(Above(TOTAL (Inv),0,If(RowNo(TOTAL)<6,RowNo(TOTAL),6)))

That might be enough to make it work.

What are the dimensions you are using and what type of chart are you using this in? Straight Table or Pivot Table?

View solution in original post

5 Replies
petter
Partner - Champion III
Partner - Champion III

You can use an expression with RangeAvg() and Above() like this:

The last column is your pre-calculated rolling average just to see that the expression RangeAvg(Above(TOTAL (Inv),0,If(RowNo()<6,RowNo(),6))) calculates to the same value.

2018-01-18 06_35_51-QlikView x64 - [C__Users_Petter_Downloads_# QC - 2018-01-18 six months rolling a.png

vikas_nandanwar
Creator II
Creator II
Author

Thanks this worked.

vikas_nandanwar
Creator II
Creator II
Author

Hi,

this works fine with the month sorted and the given sample data.

But when i use it with the auto calender date, it do not work

i.e.

RangeAvg(Above(TOTAL (Inv),0,If(RowNo()<6,RowNo(),6)))


But when my data is at a transaction date level, it donot work


please help

petter
Partner - Champion III
Partner - Champion III

Can you add TOTAL to both the RowNo() functions like this:

RangeAvg(Above(TOTAL (Inv),0,If(RowNo(TOTAL)<6,RowNo(TOTAL),6)))

That might be enough to make it work.

What are the dimensions you are using and what type of chart are you using this in? Straight Table or Pivot Table?

vikas_nandanwar
Creator II
Creator II
Author

Thanks

This worked