Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to write more values in script?

hi guys ,

i write an expression like this sum({$<year={2002},category={mobile}>}this expression have only two values but i need to write more values in this expression but i do not know how to write more values in expression.please tell me out how to write more values in expression.

Regards:

madhu

10 Replies
MK_QSL
MVP
MVP

Something Like Below

SUM({$<year = {'2002', '2003'}, category = {'mobile','abc'}>}Sales)

ariel_klien
Specialist
Specialist

Hi,

you can try:

sum({$<year={2002},category={mobile,Value2,Value3}>}....)

If you want a range of years:

sum({$<year={>2002<2012},category={mobile}>}...)



Hope this will help you.


BR


Ariel

Colin-Albert

Your expression is incorrect, you have not stated which field you are summing, also the category value must be within quotes as the data is text.


sum({$<year={2002},category={'mobile'}>} field_to_sum)

antoniotiman
Master III
Master III

You want to say

sum({$<year={2002,2003,2004},category={'mobile','pc'}>} sales)

Regrds

Not applicable
Author

thank you ariel

Not applicable
Author

thank you colin

alexandros17
Partner - Champion III
Partner - Champion III

You are missing something in writeing the expression:

sum({$<year={2002},category={mobile}>} of what?


the correct sysntax is sum({$<year={2002},category={mobile}>} myField)


If you need to add other conditions:


sum({$<year={2002},category={'mobile', 'TV'}, Type={'Flat'}>} myField)

Not applicable
Author

Use can create the set expression Variable and use the variable in the expression.This is the best way to manage the repeatedly changing values in the Set idetifieres.

Not applicable
Author

You may also like expression like this:

sum({$<year={">=2002"},category={'mobile'}>} myField)


it will calculate for years range.


regards

Darek