Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
canmarroig
Partner - Creator
Partner - Creator

Double variable data in a set analysis expr

Hi, I'm trying to solve a problem. I've a report for salesmanager and my customer is asking me to see in a table as default a total amount of sales for 'black hats', and ask two switch fields where he can select all Type (to sum also shoes and gloves) and another independent switch where select all Colours. When he deletes his selection he wants to be back to his default report for "black hats".

TableA:

LOAD * INLINE [

Product, Type, Colour    Amount

ProdA, Hat ,black, 100

ProdB, Hat, black, 200

ProdC, Hat, black, 200

ProdD, Hat, white, 50

ProdE, Hat, black, 200

ProdF, Shoes, black,  300

ProdG, Gloves, pink,  70

];

LOAD * INLINE [

Switch Type

Yes

];

LOAD * INLINE [

Switch Colour

Yes

];

Thank you in advance!

1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi,

The attached example should help. Note I had to use start ('*') instead of blank ('') for the all option.

Regards,

Jonathan

View solution in original post

7 Replies
Anonymous
Not applicable

Hi,

I'd set up two variables, SwitchType and SwitchColour, behind buttons, that would start as 'Black' and 'Hat' but when unclicked be set to an empty string state (''). You could of course change the text on the buttons to say 'All' when they are blank.

A set analysis could then say something like:

sum({$<Type={'=$(SwitchType)'},Colour={'=$(SwitchColour)'}>} Amount)

A bit crude, but would probably work.

Regards,

Jonathan

canmarroig
Partner - Creator
Partner - Creator
Author

Thank you jon, i'm trying to follow your suggestion but i don't understand when you say to start as 'Black'...you suggest usign input box to predefine value? Since i've some troubles to consider 'all' when is empty. Thank you

Anonymous
Not applicable

Hi,

The attached example should help. Note I had to use start ('*') instead of blank ('') for the all option.

Regards,

Jonathan

whiteline
Master II
Master II

Hi, jonbroughavone.

I suggest slightly modified expression:

=sum({$*$<Type={'$(SwitchType)'},Colour={'$(SwitchColour)'}>} Amount)

canmarroig
Partner - Creator
Partner - Creator
Author

Eureka, thank you!!

canmarroig
Partner - Creator
Partner - Creator
Author

Sorry why this difference? Thank you

whiteline
Master II
Master II

The $*$<..> is an intersection of sets.

Try to select a particular type in a listbox. If you use $<..> expression it overrides your selection and the table will remain the same.

I think that the user also expects to see only thouse types and colors that are selected.