Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Max Values From Multiple Rows

I have a table of values that looks like this:

     

teamName1eventDATE1cTimeOuttransQUANTITYrunningCount1
vs. TeamX 9/27/20160%2
vs. TeamX 9/27/20160%-2-2
vs. TeamX 9/27/20160%-1-3
vs. TeamX 9/27/20160%-4-7
vs. TeamX 9/27/20160%1-6
vs. TeamX 9/27/20160%2-4
vs. TeamX 9/27/20160%1-3
vs. TeamX 9/27/20160%-2-5
vs. TeamX 9/27/20168%2
vs. TeamX 9/27/20168%3030
vs. TeamX 9/27/20168%-228
vs. TeamX 9/27/20168%432
vs. TeamX 9/27/20168%-230
vs. TeamX 9/27/201617%2
vs. TeamX 9/27/201617%44
vs. TeamX 9/27/201617%-22
vs. TeamX 9/27/201617%24
vs. TeamX 9/27/201617%812
vs. TeamX 9/27/201617%-48
vs. TeamX 9/27/201617%210
vs. TeamX 9/27/201617%414
vs. TeamX 9/27/201617%216

What I need to do is extract only the max values from runningCount1 so I'm left with this:

     

teamName1eventDATE1cTimeOutrunningCount1
vs. TeamX 9/27/20160%-5
vs. TeamX 9/27/20168%30
vs. TeamX 9/27/201617%37

The starting point is a table that has been created and dropped numerous times to get it to the the point. There are also thousands of rows of data so rather than a RangeSum which I used earlier - i just want to extract the team, date, time out and highest value.I'm stuck and the following script is giving errors:

CURRENTTICKET7:

LOAD

    teamName1,

    FirstSortedValue(eventDATE1, teamName1)    as eventDATE1,

    cTimeOut,

    Max(runningCount1)    as ticketsSoldPerDay

RESIDENT CURRENTTICKET6;

Any help is appreciated

2 Replies
sunny_talwar

How is -5 the max value? It seems like it is the last value, but how did you come up with that as the last value? May be try this:

CURRENTTICKET7:

LOAD teamName1,

    eventDATE1,

    cTimeOut,

    LastValue(runningCount1)    as ticketsSoldPerDay

RESIDENT CURRENTTICKET6

Group By teamName1, eventDATE1, cTimeOut;

sumitjadhav
Creator II
Creator II

hi scott,

Kindly Try the below Script:

tab1:

LOAD teamName1,

eventDATE1,

cTimeOut,

ransQUANTITY,

runningCount1

     FROM

[path);

tab2:

LOAD

teamName1,

     eventDATE1,

     cTimeOut,

     max(runningCount1) as ticketssoldperday,

     LastValue(runningCount1) as ticket

     Resident tab1

     group By

     teamName1,

     eventDATE1,

     cTimeOut;

drop Table tab1;

Out put:

data1.JPG