Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
simon20
Partner - Contributor III
Partner - Contributor III

How to filter within the range of the value of a selection?

Hi,

I have a table that looks similar to below, with the aim to find similar alternatives to one selection:

DimensionValueStat 1Stat 2
ABC123512
DEF456434
GHI789378
JKL012227

 

So essentially what I would like to do is to create a sheet where you select one "Dimension", and the object displays the alternatives that are within 1 in value.

Example:

If I select "DEF456" I want the visualization to show the rows for ABC123, DEF456 AND GHI789. If I select JKL012 it should display JKL012 and GHI789. 

 

Labels (1)
1 Solution

Accepted Solutions
Taoufiq_Zarra

Hi,

What you think about a proposal based on data islands ?

In the load script I created a table not connected with the model

INPUTS:

LOAD * INLINE [
    Dimension, Value, Stat 1, Stat 2
    ABC123, 5, 1, 2
    DEF456, 4, 3, 4
    GHI789, 3, 7, 8
    JKL012, 2, 2, 7
];

ISLAND:
Load distinct Dimension as selected_dimension,Value as selected_Value  resident INPUTS;

 

And for users, I will display the dimension[Selected_dimension]

Capture.PNG

And I will display the results I want based on the calculated dimension

=if(Value=selected_Value+1 or Value=selected_Value-1,Dimension)

 

Outputs:

Capture.PNG.

2-

Capture.PNG

3

Capture.PNG

Cheers,

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

3 Replies
Taoufiq_Zarra

Hi,

What you think about a proposal based on data islands ?

In the load script I created a table not connected with the model

INPUTS:

LOAD * INLINE [
    Dimension, Value, Stat 1, Stat 2
    ABC123, 5, 1, 2
    DEF456, 4, 3, 4
    GHI789, 3, 7, 8
    JKL012, 2, 2, 7
];

ISLAND:
Load distinct Dimension as selected_dimension,Value as selected_Value  resident INPUTS;

 

And for users, I will display the dimension[Selected_dimension]

Capture.PNG

And I will display the results I want based on the calculated dimension

=if(Value=selected_Value+1 or Value=selected_Value-1,Dimension)

 

Outputs:

Capture.PNG.

2-

Capture.PNG

3

Capture.PNG

Cheers,

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
simon20
Partner - Contributor III
Partner - Contributor III
Author

It worked! I did some small changes to your script. The dimensions can have several rows (one per month), where I wanted to sum the stat columns over all rows, but only see the "latest" values.

Instead of putting an expression in the dimension I created a variable set to Avg(selected_value), and then created a set expression as:

Alt(Avg({<value={">=$(=$(vValueComp)-1)<=$(=$(vValueComp)+1)"},Date={$(vMaxDate)}>} value),0)

The "alt" is there to be able to filter out rows that otherwise would be seen as null when adding measures "Sum(Stat)"

Taoufiq_Zarra

Awesome

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉