Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
bob654321
New Contributor

Set Analysis expression using multiple if statements ?

How can write this if else formula using set analysis ?

 

If label = 'A' and client = 'X' then  Sum(measurefield1)/If label = 'B and client = 'Y' then  Sum(measurefield2)

If label = 'C' and client = 'X' then  Sum(measurefield3)/If label = 'D' and client = 'X' then  Sum(measurefield4)

If label = 'E' and client = 'X' then  Sum(measurefield5)

If label = 'F' and client = 'X' then  Sum(measurefield6)

 

 

4 Replies
Partner
Partner

Re: Set Analysis expression using multiple if statements ?

I think a PickMatch would be a good choice in this scenario.

Sum(Pick (Match(Label&Client,'AX','BY' ,'CX', 'DX' , 'EX') ,measurefield1, measurefield2, measurefield3, measurefield4, measurefield 5))



???
Celebrating my 300 accepted solution in the Qlik Community
???
bob654321
New Contributor

Re: Set Analysis expression using multiple if statements ?

How can I calculate the division(Sum(Measure1)/Sum(Measure2) using multiple if conditions as I mentioned in my initial post ?
qliksus
Valued Contributor II

Re: Set Analysis expression using multiple if statements ?

Since the alphabets match the field number in your requirement create a variable like the below

Variable1 = 'MEASURE'&( (ord('$(=FIELD)') +1)-65)

Expression : Sum( $(variable1 ))

The measure field will change based on the selection you make
bob654321
New Contributor

Re: Set Analysis expression using multiple if statements ?

How can I calculate the division using multiple if statements ?