Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
Partner
Partner

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

8 Replies
Highlighted
Specialist III
Specialist 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)

Highlighted
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?

Highlighted
Not applicable

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

???

and how would it be using the PRODUCT_FAMILY?

Highlighted

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

Unfortunately no ...

Highlighted
Partner
Partner

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))


Highlighted
Not applicable

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

Have you tested it?

Highlighted
Partner
Partner

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

Highlighted
Specialist III
Specialist 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