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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum(Field) as a new field in Script

Hi Qlik Community !

I'm trying to create a new table with 2 fields: ID USER and SUM([NUMBER OF LOGIN]). However, when reload the data, the following error message is displayed:

Invalid expression

TOTALLOGIN:

LOAD [ID USER],

  SUM([NUMBER OF LOGIN]) AS TOTAL_LOGINS

Resident LOGIN

My database is the following:

ID USERCHANNELNUMBER OF LOGIN
1INTERNET4
1MOBILE9
2INTERNET3
2MOBILE3
3INTERNET6
3MOBILE1
4INTERNET5
4MOBILE8
5INTERNET6
5MOBILE8
6INTERNET9
7INTERNET8
8INTERNET8
9INTERNET3
10INTERNET4
11MOBILE10
12MOBILE2
13MOBILE5

And my script:

LOGIN:

LOAD [ID USER],

     CHANNEL,

     [NUMBER OF LOGIN]

FROM

[PRUEBA_1.xlsx]

(ooxml, embedded labels);

TOTALLOGIN:

LOAD [ID USER],

  SUM([NUMBER OF LOGIN]) AS TOTAL_LOGINS

Resident LOGIN;

Does someone know why the SUM function is not recognized as valid expression?

Thanks in advance !

Regards,

Vincent

1 Solution

Accepted Solutions
Not applicable
Author

you need group by your dimensions, it means the fields you want to keep

Fabrice

View solution in original post

6 Replies
Not applicable
Author

you need group by your dimensions, it means the fields you want to keep

Fabrice

Not applicable
Author

Hi,

Exactly, you just need

Resident LOGIN

Group By [ID USER]

;

Result in attached. Regards.

Not applicable
Author

OMG, I didn't imagine it would be that easy...

Thanks a lot Fabrice!! This sentence works:

TOTALLOGIN:

LOAD [ID USER],

  SUM([NUMBER OF LOGIN]) AS TOTAL_LOGINS

Resident LOGIN

Group by [ID USER];

Not applicable
Author

Thanks Pierre !

🙂

Not applicable
Author

Hi Vincent,

Please check the attached qvw. Were you expecting the same results??

Regards,

Varsha

Not applicable
Author

Thanks a lot Varsha. These are the results I was expecting 🙂