Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
s2016
Contributor III
Contributor III

Aggregating data

Hi,

I have the attached sample data set. For each combination of "Group Name" and "EST_Date", I need to calculate the Maximum of "Peak" value. Peak for current row is derived from Average ("Throughput" current row, Throughput next row).

eg)

Peak row1 = average of Throughput (row1, row2)

Peak row2 = average of Throughput (row2, row3)

so on and so forth.

I am not able to figure out how the data for the next row can be fetched in Qlikview so that it can be averaged with the current row. Help in scripting this would be really appreciated.

NOTE: Peak value is not available in the actual dataset which comes from a database.

    

Derived
Group NameEST DateTime Slot NumberThroughputPeak
BRAS21/01/20081152256143292
BRAS21/01/20082134328130238.5
BRAS21/01/20083126149118795
BRAS21/01/20084111441106408
BRAS21/01/20085101375100557.5
BRAS21/01/200869974097986
BRAS21/01/200879623293780.5
BRAS21/01/200889132991329
143292 Max
1 Solution

Accepted Solutions
sunny_talwar

You are looking to do this in the script?

May be this:

Table:

LOAD [Group Name],

    [EST Date],

    [Time Slot Number],

    Throughput

FROM

[..\..\Downloads\Rubas-Peak-Mbits_Calculations_copy.xlsx]

(ooxml, embedded labels, header is 1 lines, table is Sheet1)

Where Len(Trim([Group Name])) > 0;

FinalTable:

LOAD *,

  If([Group Name] = Previous([Group Name]) and [EST Date] = Previous([EST Date]), RangeAvg(Peek('Throughput'), Throughput), Throughput) as Peak

Resident Table

Order By [Group Name], [EST Date], [Time Slot Number] desc;

DROP Table Table;

View solution in original post

2 Replies
sunny_talwar

You are looking to do this in the script?

May be this:

Table:

LOAD [Group Name],

    [EST Date],

    [Time Slot Number],

    Throughput

FROM

[..\..\Downloads\Rubas-Peak-Mbits_Calculations_copy.xlsx]

(ooxml, embedded labels, header is 1 lines, table is Sheet1)

Where Len(Trim([Group Name])) > 0;

FinalTable:

LOAD *,

  If([Group Name] = Previous([Group Name]) and [EST Date] = Previous([EST Date]), RangeAvg(Peek('Throughput'), Throughput), Throughput) as Peak

Resident Table

Order By [Group Name], [EST Date], [Time Slot Number] desc;

DROP Table Table;

s2016
Contributor III
Contributor III
Author

Thanks for the solution Sunny. It didn't work perfectly, but I did some tweaks and I got the desired results. Appreciate your help. Thanks again.