Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Read about the latest Qlik Community enhancements on the Community News blog!
cancel
Showing results for 
Search instead for 
Did you mean: 
marjan_it
Creator III
Creator III

How to change range of expression with 2 input box

Hi All

I have a chart that has a expression 'count(DISTINCT( if(FlowStatusID='19',MessageID)))'

I want to have 2 input box that define min and max .when  type min 0 and max 2 show the expression between 0 and 2. I defind variable but it does not work ok. 

this is my chart.

codecount
00000000001
00100905761
00102308231
00102723135
00102921873
00103307200
00104976844
00105778411
00106227991
00106477834
00106504743
00107049913
00107083400
00107290031
00107472140
00107560191
Labels (5)
5 Replies
rubenmarin

Hi, it can be:
If(count(DISTINCT {<FlowStatusID={'19'}>} MessageID)>=S(varMinValue)
and count(DISTINCT {<FlowStatusID={'19'}>} MessageID)<=$(varMaxValue),
count(DISTINCT {<FlowStatusID={'19'}>} MessageID)
)

Or if you want to show allways the min and max values:
RangeMin(
RangeMax($(varMinValue), count(DISTINCT {<FlowStatusID={'19'}>} MessageID))
, $(varMaxValue))

You can also mix both, ie show all above min but capped at max:
If(count(DISTINCT {<FlowStatusID={'19'}>} MessageID)>=S(varMinValue)
RangeMin(count(DISTINCT {<FlowStatusID={'19'}>} MessageID)
, $(varMaxValue)))
marjan_it
Creator III
Creator III
Author

No It dosent work correctly.
I found this code on the community Its work ok with just one dimension, but when we add more than one dimension it dose not work.
count(DISTINCT{$< [PersonNationalCode]={"=(count(DISTINCT( if(FlowStatusID='19',MessageID)))>= $(min)) and (count(DISTINCT( if(FlowStatusID='19',MessageID)))<= $(=max))"}>}if(FlowStatusID=19, MessageID))
rubenmarin

Probably the second dimension is messing with the expression but it's hard to know without a look to model or at least wich dimensions are used.
Can you upload a sample?
marjan_it
Creator III
Creator III
Author

No I cant upload my real sample. but I want to make a chart with for example 3 dimensions like below table and the expression is this condition in the "count(distinct (if (FlowStatusID=19,MessageID)))" range of input box

 

rubenmarin

This table doesn't have FlowStatusID or MessageID and the issue most probably is caused becuase of the relation wirth the dimensions and this values.

Usually one solution when something works with one dimension and not with many it can be use an aggr(), wich can impact performance:

Sum(Aggr(count(DISTINCT{$< [PersonNationalCode]={"=(count(DISTINCT( if(FlowStatusID='19',MessageID)))>= $(min)) and (count(DISTINCT( if(FlowStatusID='19',MessageID)))<= $(=max))"}>}if(FlowStatusID=19, MessageID)), [Dim1],[Dim2],[Dim3]))