Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a Metro Map with data on stations. The circles should get colors - green, yellow, red accordingly to some range on data they have.
So, I need to create a slider which will show three scales - for the green\yellow\red color.
Can you please advise me how to do that?
I tried to look in the following link, bit it is not working there:
https://community.qlik.com/t5/New-to-Qlik-Sense/How-to-use-Range-slider-in-qlik-sense/td-p/992934
https://community.qlik.com/t5/Documents/Qlik-Sense-Introduction-to-Extensions-video/ta-p/1480079
ok, now I've got your point.
In script just add two new rows (variables) of code, i.e.:
SET vLowerBorder = 0.01; //default value to be 0.01
SET vUpperBorder = 0.08; //default value to be 0.08
In color expression use $(vLowerBorder) and $(vUpperBorder) instead of values you currently use.
=if(
count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)>=0 and count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<$(vLowerBorder),
green(),
if(
count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)>=0.01 and count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<$(vUpperBorder),
yellow(),red())).
By the way, you can adjust a bit your color expression to make it easier and faster calculated. I do not expect to have negative values as a result of calculation, so it could possibly look like:
if(count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<$(vLowerBorder), Green(),
if(count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<$(vUpperBorder), Yellow(),Red()))
Then in the front-end (GUI) use following object and variables you have created.
BR
m
HI @Inna_Shnaiderman ,
I am not sure whether I catch your point. I would propose kind of possible solutions for you:
If it is not suitable for your case, could you please provide sample of data and any visualization you want to achieve?
Thanks.
m
Hi.
I went over the link and it is not exactly what I need.
I wrote formula (working), which for every percentage gives its color:
=if(
count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)>=0 and count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<0.01,
green(),
if(
count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)>=0.01 and count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<0.08,
yellow(),red()))
I need instead of fixed percentage (0.01,0.08 and more) to make it configurable. Means the percents for colors should be changeable variables. The variables should be changed by users.
Questions:
1. How to create in Qlik Sense Variables?
2.How these variables can be changed by users in UI?
ok, now I've got your point.
In script just add two new rows (variables) of code, i.e.:
SET vLowerBorder = 0.01; //default value to be 0.01
SET vUpperBorder = 0.08; //default value to be 0.08
In color expression use $(vLowerBorder) and $(vUpperBorder) instead of values you currently use.
=if(
count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)>=0 and count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<$(vLowerBorder),
green(),
if(
count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)>=0.01 and count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<$(vUpperBorder),
yellow(),red())).
By the way, you can adjust a bit your color expression to make it easier and faster calculated. I do not expect to have negative values as a result of calculation, so it could possibly look like:
if(count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<$(vLowerBorder), Green(),
if(count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<$(vUpperBorder), Yellow(),Red()))
Then in the front-end (GUI) use following object and variables you have created.
BR
m
Great!Working!