Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Nolgath
Creator
Creator

Interval Filter

Hello,

I have a question, I have a column with KMs with ranges like 15,5023,28855,293754,100040 etc..

And in my filter i need to have intervals like 5000-10000-15000-20000 etc, 5000 per 5000 km selection..

 

Is it possible?

Labels (2)
1 Solution

Accepted Solutions
MayilVahanan

Hi

Either, you can create a field in script by using if statement like

if(Kms <= 5000, '<= 5000', if(Kms <= 10000, '5000-10000', '>10000')) as KmsRange

and use KmsRange field in front end.

Else, try with Class function as dimension in front end like

=Class(Kms , 5000, 'KmsRange')

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

7 Replies
MayilVahanan

Hi

Either, you can create a field in script by using if statement like

if(Kms <= 5000, '<= 5000', if(Kms <= 10000, '5000-10000', '>10000')) as KmsRange

and use KmsRange field in front end.

Else, try with Class function as dimension in front end like

=Class(Kms , 5000, 'KmsRange')

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Nolgath
Creator
Creator
Author

Omg thank you Mayil! 

 

It worked perfectly!

 

I have the filter like "0<=KmsRange < 5000" for each line of filter as its name, is there a way I can put like 5000,10000,15000? That is an extra.. if it is possible

 

 

MayilVahanan

in that case, you need to create the field in the script and use in the front end. 

Thanks

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Nolgath
Creator
Creator
Author

It's all ok, i have some script errors here, any ideia? 

Sorry last question!

Nolgath
Creator
Creator
Author

Its all good! My mistake, i am a rookie still..

 

Thank you!!

Nolgath
Creator
Creator
Author

if([KM from] <= 15000, '<= 15000', if([KM from] <= 15000, '15000-20000', '>20000')) as Km_from

Can I do this further? Like untill 300000 ? I ve tried :

if([KM from] <= 5000, '<= 5000', if([KM from] <= 10000, '5000-10000', '>10000',
if([KM from] <= 15000, '<= 15000', if([KM from] <= 15000, '15000-20000', '>20000')))) as Km_from,

with no success.. 

 

any clue?

MayilVahanan

Hi 

Try like below

if([KM from] <= 5000, '<= 5000', if([KM from] <= 10000, '5001-10000', 
if([KM from] <= 15000, '10001-15000', if([KM from] <= 20000, '15001-20000', '>20000')))) as Km_from,

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.