Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

General filter pane selection coding Qlik Sense

Hi everyone,

I am wondering if I can code something in the Qlik. I am trying to say that if our product segment dimension is selected via a filter pane and one of our product lines is selected, then be rgb(0,0,0).

I am wondering if there is a way to say if any part of a dimension (product line) is selected then do something

if([Product Segment]='Shoes' and [Product Line]='XXXX', rgb(0,0,0))

The expression works if I put in a specific product line name like "running" or "walking", but I am trying to code it to work if ANY product line is selected.

Is there a general term I can put in for the XXXX above to mean if any product line is selected?

Thanks in advance.

1 Solution

Accepted Solutions
felipedl
Partner - Specialist III
Partner - Specialist III

If I understood correctly, try this:

if

(

GetSelectedCount([Product Segment])=0 and GetSelectedCount([Product Line])=0,yellow(),

    if

    (

    GetSelectedCount([Product Segment])<>0 and GetSelectedCount([Product Line])<>0,

        Green(),

        if

    (

    GetSelectedCount([Product Line])<>0,

Blue(),

            red()

        )

    )

)

It will paint the grapho yellow if nothing is selected, green if both fields are selected, red if only Product Segment is selected and blue if only Product Line is selected.

View solution in original post

4 Replies
felipedl
Partner - Specialist III
Partner - Specialist III

Hi Russel,

What you can do is use the GetSelectedCount([Product Line]) statement, something like:

if([Product Segment]='Shoes' and GetSelectedCount([Product Line])>0, green(),red())

For my example, ive used the following code:

data:

Load * Inline

[

Date,Product Segment,Product Line,Sales

    01/01/2017,Shoes,Running,111

    02/01/2017,Shoes,Hiking,531

    03/01/2017,Bike,Mountain bike,1013

    02/01/2017,Bike,Urban,693

    04/01/2017,Equipment,Bow,12

    05/01/2017,Equipment,Bat,111

];

And got this (selecting shoes only)

Sample.png

And got this (selecting shoes and whatever selection on Product Line):

Sample.png

Anonymous
Not applicable
Author

This works; however, if no product line is selected and just the segment is selected, how do I set thresholds at that level? I can do the

if([Product Segment]='Shoes' and GetSelectedCount([Product Line])>0, green(),red())

and then a , for the if not and put a general threshold if non are selected.

I am also trying to input thresholds if only the segment is selected if that is possible.

felipedl
Partner - Specialist III
Partner - Specialist III

If I understood correctly, try this:

if

(

GetSelectedCount([Product Segment])=0 and GetSelectedCount([Product Line])=0,yellow(),

    if

    (

    GetSelectedCount([Product Segment])<>0 and GetSelectedCount([Product Line])<>0,

        Green(),

        if

    (

    GetSelectedCount([Product Line])<>0,

Blue(),

            red()

        )

    )

)

It will paint the grapho yellow if nothing is selected, green if both fields are selected, red if only Product Segment is selected and blue if only Product Line is selected.

Anonymous
Not applicable
Author

Thanks, will try this and let you know.