Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Load script

Hi all,

Can i load only the counts of values in a column from the DB instead of loading the whole column.

For example: I have login table where we will save the user details like user_id, login_date, and some more... every time when user logged in.

Now i need just count(user_id) which give the number of logins.

My scenario is instead of loading the whole data, i need to apply set analysis in the load script itself.

Is all functions like max, sum, count can be used in load script  in Qlik sense?

Regards,

Kumar

Tags (1)
7 Replies
MVP
MVP

Re: Load script

You can use all the functions you mentioned, but not Set Analysis in the script. However, that you should not be worried about, because you can achieve your goal  in the script without that. Try like:

Load

          user_id,

          Count(user_id) as user_count

from <> Group By user_id;

'Group By' is important when using any aggregation function in the script. Learn about it.

balrajahlawat
Esteemed Contributor

Re: Load script

Yes, you can use all mentioned function at script level. As these function are aggregate function so you need to group them which you can do by Group By.

Set Analysis is used at front end not at script level, but yeah as tresesco‌ mentioned their are alternates to achieve your goal with the same output as it is done by Set Analysis at UI level, same you can achieve at script level too.

Not applicable

Re: Load script

I don't want load user_id, but only Count(user_id) as user_count.

Is this possible?


MVP
MVP

Re: Load script

Possible. Try it and let know if any issues.

Not applicable

Re: Load script

NO, I am getting error as odbc failed...

ogster1974
Honored Contributor II

Re: Load script

screen shot your piece of script and tell us the type of database you are using.  So people can help you better.

ogster1974
Honored Contributor II

Re: Load script

For example

[UserVisit]:

LIB CONNECT TO [Your DB];

LOAD [NumberVisits];

SQL SELECT COUNT(user_id)

FROM db.dbo.LoginTable;

Should get you the answer you want with a little tweeking

Community Browser