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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
chhavi376
Creator II
Creator II

Using Function in Set Analysis

Hi All,

=sum({<pat_id =

$(=

Replace(

vInclude,

'P({<TypeDesc={'&chr(39)&TypeDesc&chr(39)&'},'&'Value={'&chr(39)&'1'&chr(39)&'}>}pat_id)',

'P({<TypeDesc={'&chr(39)&TypeDesc&chr(39)&'},'&'Value={'&chr(39)&'*'&chr(39)&'}>}pat_id)'

))

>}Value)

I wanted to use a function in set analysis (Please refer to the expression above)

But it seems that the function is not rightly calculated.

is there a way to fix this?

regards,

Chhavi

6 Replies
felipedl
Partner - Specialist III
Partner - Specialist III

Hi Chavi,

As a guess, you're missing the starting / ending bracket for the set analysis expression

=sum({<pat_id =

{"

$(=

Replace(

vInclude,

'P({<TypeDesc={'&chr(39)&TypeDesc&chr(39)&'},'&'Value={'&chr(39)&'1'&chr(39)&'}>}pat_id)',

'P({<TypeDesc={'&chr(39)&TypeDesc&chr(39)&'},'&'Value={'&chr(39)&'*'&chr(39)&'}>}pat_id)'

))

"}

>}Value)


Felipe.

chhavi376
Creator II
Creator II
Author

Hey,

That was a copy paste error,

This gives me result as '0', Still does not work properly.

felipedl
Partner - Specialist III
Partner - Specialist III

See what your expression is returning, put a table chart and paste the expression, to check whats being evaluated.

Example:

sample.png

As a side note, im assuming that the expression you're using with the identation is getting a false error, this expression worked for me:

sum({<pat_id =

{"$(=Replace(vInclude,

'P({<TypeDesc={'&chr(39)&TypeDesc&chr(39)&'},'&'Value={'&chr(39)&'1'&chr(39)&'}>}pat_id)',

'P({<TypeDesc={'&chr(39)&TypeDesc&chr(39)&'},'&'Value={'&chr(39)&'*'&chr(39)&'}>}pat_id)'))"}

>}Value)

and gave me the picture result, with vInclude having value 1 and using the bellow code for dummy data:

load * Inline

[

pat_id,TypeDesc,Value

x,A,1

2,B,10

1,C,100

]

Felipe.

sunny_talwar

Would you be able to share a sample to show what exactly are you trying to accomplish?

chhavi376
Creator II
Creator II
Author

Hi Sunny,

I am attaching the test App

PFB the example to explain the functionality of 'Exp2':

When nothing is selected:

1.PNG

the moment I select anything from Include/Exclude Filters, the value in Exp1 which was appearing befor the selection of that particular filter should appear in Exp2

2.PNG

now if i select anything from Exclude (Say cardiac) the value in Exp2 should be '-1' (Exp1 for cardiac in the above screenshot)

I am trying to use the column 'Test' in the set analysis used in Exp2

sunny_talwar

Is this sort of what you are looking to do?

Capture.PNG