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

Use Slider as filter

I am trying to use a slider to filter my chart.

I have a calculation 

=Count(Distinct {$<Status={'Done'}>}ID)/Count(DISTINCT ID)

This will be a percentage value range from 0% to 100%.

I want a slider to filter the % range.  So I can filter anything below 50% or anything between 90% & 100% etc.

I need help with setting this up. 

Sample is attached.

 

 

1 Solution

Accepted Solutions
mfchmielowski
Creator II
Creator II

Hi.

In my opinion the simpliest way is to calculate the % in load script and then prepare the set analisys based on sliders with two variables for lower and upper bound.

I've loaded your qvw with binary and added calculations like:

NoConcatenate
Loaded:
load *, Team &'|'& day_month_year as joinKey Resident Data;

drop table Data;


Status:
load
	joinKey
	, DoneQuantity/Quantity as DonePercent
;
load
	joinKey
	, sum(match(Status, 'Done')) as DoneQuantity
	, count(DISTINCT ID) as Quantity
Resident
	Loaded
group by
	joinKey
;

left join(Loaded)
load * Resident Status;

drop table Status;
drop field joinKey;

 

Then added two variables: lowerBound, upperBound.

Set the slider for: VariableBased, MultipleValues
Min. value: 0
Max. value: 1
Static step: 0.1
In pivot added to expressions: {<DonePercent={">=$(lowerBound)<=$(upperBound)"}>} 

Column 'Count': Count({<DonePercent={">=$(lowerBound)<=$(upperBound)"}>} DISTINCT ID)
Column 'Done': Count(Distinct {$<Status={'Done'}, DonePercent={">=$(lowerBound)<=$(upperBound)"} >}ID)
Column '%Done': column(2)/column(1)

See the attached file. I didn't have the csv file so i've loaded yours qvw binary (as mentioned before).
Hope this help 🙂

View solution in original post

2 Replies
mfchmielowski
Creator II
Creator II

Hi.

In my opinion the simpliest way is to calculate the % in load script and then prepare the set analisys based on sliders with two variables for lower and upper bound.

I've loaded your qvw with binary and added calculations like:

NoConcatenate
Loaded:
load *, Team &'|'& day_month_year as joinKey Resident Data;

drop table Data;


Status:
load
	joinKey
	, DoneQuantity/Quantity as DonePercent
;
load
	joinKey
	, sum(match(Status, 'Done')) as DoneQuantity
	, count(DISTINCT ID) as Quantity
Resident
	Loaded
group by
	joinKey
;

left join(Loaded)
load * Resident Status;

drop table Status;
drop field joinKey;

 

Then added two variables: lowerBound, upperBound.

Set the slider for: VariableBased, MultipleValues
Min. value: 0
Max. value: 1
Static step: 0.1
In pivot added to expressions: {<DonePercent={">=$(lowerBound)<=$(upperBound)"}>} 

Column 'Count': Count({<DonePercent={">=$(lowerBound)<=$(upperBound)"}>} DISTINCT ID)
Column 'Done': Count(Distinct {$<Status={'Done'}, DonePercent={">=$(lowerBound)<=$(upperBound)"} >}ID)
Column '%Done': column(2)/column(1)

See the attached file. I didn't have the csv file so i've loaded yours qvw binary (as mentioned before).
Hope this help 🙂

QFabian
Specialist III
Specialist III

Hi @sqlpuzzle , you can create first a variable : vP in this case

QFabian_1-1613510528167.png

Then Configure your chart, a pivot table in this case, telling it what to show , usig the variable :

QFabian_0-1613510503510.png

And then configure your slider like this :

QFabian_2-1613510631685.png

 

 

QFabian