Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis with variable

Hello everyone,

I have a problem with a set analysis using variable.

I want to change the calculation according to the user selection.

To do that, I made a selection with two values load by a load inline.

This two value are fields available in my script.

LOAD * INLINE [_InvoiceA_Or_InvoiceB

    INVOICE_A

    INVOICE_B

];

With this, I made a variable vInvoice with :

=GetCurrentSelections(_InvoiceA_Or_InvoiceB)

Thereafter, I write my set analysis like :

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

Unfortunately, my calculation doesn't work.

Is someone can help me ?

Thanks

1 Solution

Accepted Solutions
its_anandrjs

Try with in place of the  =GetCurrentSelections(_InvoiceA_Or_InvoiceB)

=GetFieldSelections(_InvoiceA_Or_InvoiceB)

And then write like

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

View solution in original post

9 Replies
mdmukramali
Specialist III
Specialist III

Dear,

Instead of =GetCurrentSelections(_InvoiceA_Or_InvoiceB)


try

vInvoice  =Only(_InvoiceA_Or_InvoiceB)


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



MayilVahanan

Hi

Did you select any selections??

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Hello,

Yes I select a selection

Thanks for your response.

I try

vInvoice  =Only(_InvoiceA_Or_InvoiceB)

But it doesn't work either.

I wonder if my two values

    INVOICE_A

    INVOICE_B

are really link to my fields with the same name ?


Thanks !

its_anandrjs

Try with in place of the  =GetCurrentSelections(_InvoiceA_Or_InvoiceB)

=GetFieldSelections(_InvoiceA_Or_InvoiceB)

And then write like

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

ashfaq_haseeb
Champion III
Champion III

Hi make sure values

INVOICE_A

INVOICE_B


Must have same name in table if not try be renaming your inline table field to match your source.


Regards

ASHFAQ

Not applicable
Author

It works with this !

Thank you very much

its_anandrjs

Thanks I am Glad it works

Regards,

Anand

smirkinaa
Contributor III
Contributor III

Hi, one question, at what point is initialized variable "vInvoice"?

Not applicable
Author

Hello,

The variable vInvoice is defined is the menu of QlikView application :

capture1.png

Then you create the variable "vInvoice", and for definition I typed :

=GetFieldSelections(_InvoiceA_Or_InvoiceB)