Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Set Analysis with a variable in the filters (possible?)

Dears, I would like to do a set analysis using variables, but the variable would be the filter of the formula, for example:

This is the normal

=Sum({$<PRODUCT_FAMILY={"Family"}>}($(vInvoice))


I want to use the variable in the <  > (in the place of PRODUCT_FAMILY)


How do I do that?

Tags (2)
1 Solution

Accepted Solutions
gmoraleswit
Contributor II

Re: Re: Set Analysis with a variable in the filters (possible?)

Yes, see attach

8 Replies
sudeepkm
Valued Contributor III

Re: Set Analysis with a variable in the filters (possible?)

EDIT:

surprising I added the variable inside but it didn't show up

=Sum({$<PRODUCT_FAMILY={"$(vInvoice)"}>}Sales)


=Sum({$<PRODUCT_FAMILY={""}>}Sales)

Not applicable

Re: Set Analysis with a variable in the filters (possible?)

I would like to place the variable vInvoice inside the < >, instead of PRODUCT_FAMILY

but it is not working properly. How do I do that?

Not applicable

Re: Set Analysis with a variable in the filters (possible?)

???

and how would it be using the PRODUCT_FAMILY?

Re: Set Analysis with a variable in the filters (possible?)

Unfortunately no ...

gmoraleswit
Contributor II

Re: Set Analysis with a variable in the filters (possible?)

Declare a variable with the value : PRODUCT_FAMILY={"Family"}

Use it in your expression:

=Sum({$<$(vVar)>}($(vInvoice))


You can also use multiple variables:


=Sum({$<$(vVar),$(vVar2)>}($(vInvoice))


Not applicable

Re: Set Analysis with a variable in the filters (possible?)

Have you tested it?

gmoraleswit
Contributor II

Re: Re: Set Analysis with a variable in the filters (possible?)

Yes, see attach

sudeepkm
Valued Contributor III

Re: Re: Set Analysis with a variable in the filters (possible?)

I'm sorry I thought you are asking to have a field value taken from a variable.

but please take a look at the example.

I've declared a variable as Field name and used that in set analysis. I thought it would not work.

aa.png

Community Browser