Discussion board where members can get started with Qlik Sense.
I have a column "Distance" with values like
I want to create a pie chart as >1 km, >2 km. >5 km. >10km >20km
I suppose we have to use some between/range function. Please advise how can I achieve this.
check out this: Buckets
Create a Bucket Like this and then use that Bucket as a Dimension with required expression?
If(Distance>0 and Distance<=1, dual('<1KM',1),
If(Distance>1 and Distance<=5, dual('<1-5KM',2),
If(Distance>5 and Distance<=10, dual('<5-10KM',3)))) as NewDim
There are multiple ways of acheiveing this.
1) You can so it in the script load using an if statement to categorise it.
For time intervals check this:IntervalMatch
2) Use a class() function in the script: https://community.qlikview.com/thread/87214
I have dragged a pie chart on sheet and in dimension added "Distance" and in measure fx I am writing this code
If(Distance>5 and Distance<=10, dual('<5-10KM',3))))
The result are still not correct. Not sure how to work with a single field values.
Instead you can use this. Would be easier to make buckets:
class(Distance,5) : this will break it into 0 <= x <= 5, 6<= x <= 10 ans so on.
Or else: in your script use this:
If(Distance>0 and Distance<=1, 1,
If(Distance>1 and Distance<=5, 2,
If(Distance>5 and Distance<=10, 3))) as code //in your load statement
Load * inline [
I have loaded the values from excel.
u can write like this in editscrpit,
if(Distance>0,if(Distance<=1,' <1 KM',if(Distance>1,if(Distance<=5, '<1-5 KM','<5-10 KM')))) as Racelength
and in the Pie Chart
In Dimension Racelength
and in the Expression
Count(if(Racelength>0,if(Racelength<=1,'<1 KM'),if(Racelength>1,if(Racelength<=5, '< 1-5 KM'),'<5-10 KM')))