Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

canmarroig
New Contributor III

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
jonbrough
Valued Contributor

Re: Double variable data in a set analysis expr

Hi,

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

Regards,

Jonathan

7 Replies
jonbrough
Valued Contributor

Re: Double variable data in a set analysis expr

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
New Contributor III

Re: Double variable data in a set analysis expr

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

jonbrough
Valued Contributor

Re: Double variable data in a set analysis expr

Hi,

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

Regards,

Jonathan

whiteline
Honored Contributor II

Re: Double variable data in a set analysis expr

Hi, jonbroughavone.

I suggest slightly modified expression:

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

canmarroig
New Contributor III

Re: Double variable data in a set analysis expr

Eureka, thank you!!

canmarroig
New Contributor III

Re: Double variable data in a set analysis expr

Sorry why this difference? Thank you

whiteline
Honored Contributor II

Re: Double variable data in a set analysis expr

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.

Community Browser