Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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
MVP
MVP

Re: how to write more values in script?

Something Like Below

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

ariel_klien
Valued Contributor

Re: how to write more values in script?

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

Re: how to write more values in script?

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
Honored Contributor III

Re: how to write more values in script?

You want to say

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

Regrds

Not applicable

Re: how to write more values in script?

thank you ariel

Not applicable

Re: how to write more values in script?

thank you colin

Re: how to write more values in script?

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

Re: how to write more values in script?

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

Re: how to write more values in script?

You may also like expression like this:

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


it will calculate for years range.


regards

Darek

Community Browser