Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join us for a live Q&A! September 21, 10 AM ET - Onboarding Fast in Qlik Sense SaaS! REGISTER
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)

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
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)