Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
robleab2018
Contributor
Contributor

Operators (and and or in sql) in set analysis

Hello QV community!

I'm hoping someone will help me changing BusinessObjects sql to QV set analysis. I'm having a hard time matching up data with the equivalent OR and AND operators in set analysis. Does anyone see anything that is wrong?

thanks

The records must meet the first criteria and then either the first OR stmt or the 2nd stmt.

--business objects sql query

  AND      scorpion.a_segatyelm.segaty_cd = 'C' 

   AND   scorpion.a_agtdty.agt_dty_cd  NOT IN  ( 'R','0'  )

   AND   scorpion.a_crs.crs_cd  <>  'B'

   AND   scorpion.a_ascbllcls.ascbll_ind = 'Y' 

   AND   (   

          scorpion.a_segsts.segsts_cd  =  'NO'

              OR

                   (     scorpion.v_prvsegsts.prvsegsts_cd  =  'NO'

                    AND

               scorpion.a_segsts.segsts_cd  IN  ( 'XX','XK'  )         )

 

--qlikview set analysis with OR and AND operators

=Sum({(<agt_dty_cd={'R','0'},segaty_cd={'C'},ascbll_ind={'Y'},crs_cd-='B'>)*<cursegsts_cd={'NO'}>+<prvsegsts_cd={'NO'},cursegsts_cd={'XX','XK'}>}ar_qty)

2 Replies
Anil_Babu_Samineni

Not really sure

Sum(If((scorpion.a_segatyelm.segaty_cd = 'C' and Not Match(scorpion.a_agtdty.agt_dty_cd, 'R', '0')) and (scorpion.a_crs.crs_cd  <>  'B'

and scorpion.a_ascbllcls.ascbll_ind = 'Y') and

(scorpion.a_segsts.segsts_cd  =  'NO' or (scorpion.v_prvsegsts.prvsegsts_cd  =  'NO' and Match(scorpion.a_segsts.segsts_cd, 'XX','XK')), ar_qty))


Or

=Sum({(<agt_dty_cd={'R','0'},segaty_cd={'C'},ascbll_ind={'Y'},crs_cd-='B'>*<cursegsts_cd={'NO'}>+<prvsegsts_cd={'NO'},cursegsts_cd={'XX','XK'}>}ar_qty)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

May be this

=Sum({(<agt_dty_cd={'R','0'},segaty_cd={'C'},ascbll_ind={'Y'},crs_cd-='B'>)*(<cursegsts_cd={'NO'}>+<prvsegsts_cd={'NO'},cursegsts_cd={'XX','XK'}>)} ar_qty)