Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis Question

I have the following data as shown in the table below.

CNS=ANS - WANS

CR= AR-WAB

While calculating the total, I need only those months selected where ANS <>0 and WANS <>0. I am trying to setup the set analysis for this a need some help. If anyone can suggest the appropriate set analysis statement, I would appreciate it.

I am getting the value of 6.22 while I should get 4.98 when calculating the Totals

  

MonthANSARWANSWABCNSCRCNS/CR
Jan-1525100025102.50
Feb-151002311389204.45
Mar-1520943299180345.29
Apr-15005013-50-133.85
May-15007624-76-243.17
Total3347616649168276.22
Correct Total309664012269544.98
1 Solution

Accepted Solutions
qlikviewwizard
Master II
Master II

7 Replies
PrashantSangle

Hi,

What is your current expression for calculating total???

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

The corrected total should select those months where ANS <>0 and WANS <>0

e.g, 309= 100+209 for months Feb and Mar ignoring the other months.

Thanks

Not applicable
Author

The correct expression for calculating the total of 4.98 is 269/54 i.e CNS/CR

Thanks

maxgro
MVP
MVP

ANS 309

if(Dimensionality()=0,

  sum(aggr(if(sum(ANS)>0 and sum(WANS)>0, sum(ANS)),Month)),

  sum(ANS)

  )

WANS 40

if(Dimensionality()=0,

  sum(aggr(if(sum(ANS)>0 and sum(WANS)>0, sum(WANS)),Month)),

  sum(WANS)

  )

qlikviewwizard
Master II
Master II

Capture.PNG

Not applicable
Author

Thanks for the replies. I was able to get to what I needed using a combination of both your ideas. Thanks again.

qlikviewwizard
Master II
Master II

Hi Naresh,

Please close the discussion by selecting Correct answer and Helpful.