Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
abhaysingh
Specialist II
Specialist II

Expression help set analysis

Hi all

i have one field  FIELD whose values are DS and IS, i want to write expression of sales

sum({<FIELD = {'DS'}>} Sales= this give me sales w.r.t DS

sum({<FIELD = {'IS'}>}Sales = this give me sales w.r.t IS

i want to write it in single expression like if i select DS than it will me DS sales else IS sales in single expression....

pls help.

6 Replies
shree909
Partner - Specialist II
Partner - Specialist II

Hi use if condition

If (FIELD = 'DS' ,sum({<FIELD = {'DS'}>} Sales),

If (FIELD = 'IS' ,sum({<FIELD = {'IS'}>} Sales)))


Thanks


abhaysingh
Specialist II
Specialist II
Author

i want to write it in set analysis..

Not applicable

Set a variable like:
vField  =if(GetSelectedCount(Field)>0,concat(GetFieldSelections(Field),','),'IS')

then use the Expression:
sum({<Field={"$(vField)"}>} Sales)

Not applicable

Maybe like attached? Similar to above posts

manoj217
Creator III
Creator III

so you are asking you have a list box if you select DS it need to show sales WRT DS right

manoj217
Creator III
Creator III

if (getfieldselections(fields)='DS',sum({<FIELD = {'DS'}>} Sales,sum({<FIELD = {'IS'}>}Sales)