Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Case Portal will move to Qlik Community Oct 4. Temporary case outage Oct 3. READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Micki
Creator
Creator

Calculate Average in KPI from tables columns/current+previous rows

Hi, folks 

I don't have idea how to put those value ion KPI using set analysis:

 

NPrevious  valueCurrent ValueDifference
132320
232320
332320
433321
533330
633330
733330
833330
939336
1039390
113839-1
1239381
1341392
1444413
15624418
 Average 2

1. First need to calculate difference between current and previous rows (if first row doesn't have previous use current)

2. Calculate the average based on difference 

Please note that's all should be in KPI not in table 

Thank you for you time and consideration 

1 Solution

Accepted Solutions
rubenmarin

Hi @Micki,  for this data:

Data:
LOAD * INLINE [
    N, Current Value
    1, 32
    2, 32
    3, 32
    4, 33
    5, 33
    6, 33
    7, 33
    8, 33
    9, 39
    10, 39
    11, 38
    12, 39
    13, 41
    14, 44
    15, 62
];

You can use

=Avg(Aggr(Rangesum([Current Value]-Above([Current Value])), N))

View solution in original post

1 Reply
rubenmarin

Hi @Micki,  for this data:

Data:
LOAD * INLINE [
    N, Current Value
    1, 32
    2, 32
    3, 32
    4, 33
    5, 33
    6, 33
    7, 33
    8, 33
    9, 39
    10, 39
    11, 38
    12, 39
    13, 41
    14, 44
    15, 62
];

You can use

=Avg(Aggr(Rangesum([Current Value]-Above([Current Value])), N))

View solution in original post