Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Rank for each day

Hi,

I have a table with two columns. One column is date and the other is searchword. The table is 23 million rows for 4 month of data witch mean i have alot of data. To narrow it down i wish to only retrive the 1000 most common searchword for each day, how can i do that?

Br

Daniel

7 Replies
prieper
Master II
Master II

Hi,

have no ready solution but think the below should do:

Load data grouped by date and criteria and Count(Criteria)
Sort by the Count DESC
Write into new table, adding RecNo()
Filter by the topmost n RecNo()

Peter

Not applicable
Author

Hi,

I have done that, but then i get the most popular suarches for the whole period and not on day-level.

BR

Daniel

Not applicable
Author

Do you want to retrieve 1000 kewords for each day. ie if you have 10 days data, then you will get 10*1000 keywords. Is that what you want?
Not applicable
Author

that is correct. 1000 posts for each day.

prieper
Master II
Master II

Hi,

instead of the RecNo() you then should work with PEEK-function, something like

IF(PEEK(MyDate) = MyDate, PEEK(RankPerDay) + 1, 1) AS RankPerDay

HTH
Peter

Not applicable
Author

I have this code:

Normal 0 21 false false false SV X-NONE X-NONE MicrosoftInternetExplorer4

traffic:

load

time_event,

search

FROM

QVD\Traffic_event.qvd (qvd);


traffic2:

load

time_event,

search,

count(name) as count

resident traffic

group by time_event, search;

drop table traffic;

But then i want to just retrive the 1000 most common earches for each day. Could peek work?

br

/D



Not applicable
Author

The following solution will retrieve the whole values from database initially and will remove the unwanted values from QlikView.

TempKeywords:
Load Date,
Keyword,
NumberOfSearch,
if(DATE=peek(DATE),peek(rank)+1,1)as rank;
SQL Select count(*) as NumberOfSearch, Keyword ,Date FROM KEYWORD_TABLE
GROUP BY Date , Keyword ORDER BY Date , count(*) DESC;

Keywords:
Load Date,
Keyword,
NumberOfSearch,
rank
Resident TempKeywords
where rank<=1000;
Drop table TempKeywords;