As usually when trying to develop a certain new functionality or model, in QlikView™ or other software, I enjoy starting with a prototype that has a pretty simple set of data behind.
Some times I load this set of data using some short LOAD * INLINE , while in other occasions, when a data set with more cases is required, especially one that I am aware I will need to extend, I choose to have some Excel files/sheets as data sources.
LOAD * INLINE [
Dimension
1
2
30
40
50
600
700
800
900
];
We’ve started with the regular approach: a calculated dimension CLASS (Dimension,BoundaryDistance) and a pretty simple function in the expression: count(Dimension) over a bar chart.
And this gave me a pretty easy to predict answer:



=dual(
pow(10,floor(log10(Dimension),1))
& ‘<=x<‘
& pow(10,ceil(log10(Dimension),1))
,class(log10(Dimension),1, ‘Dimension’)
)

All nice there with a small exception: the first interval seems pretty strange ! (1<=x)

Now, looking at the last 2 figures, it’s clear where the problem of the first bucket is coming from: we are attempting to use log(o) within the calculation steps of the first value within the calculated dimension.
But log(o) is minus infinite and therefore the calculation is going wild !
=dual(
if( pow(10,ceil(log10(Dimension),1))=1
, 0&'<=x<‘&10
,pow(10,floor(log10(Dimension),1))
&'<=x<‘
& pow(10,ceil(log10(Dimension),1))
)
,class(log10(Dimension),1)
)

=dual(
if( pow(10,ceil(log10(Dimension),Variable1))=1
, 0&'<=x<‘&10
,pow(10,floor(log10(Dimension),Variable1))
&'<=x<‘
& pow(10,ceil(log10(Dimension),Variable1))
)
,class(log10(Dimension),Variable1 ))

and like this for Variable=2:

if( pow(10,ceil(log10(Dimension),Variable1))=1
, 0&'<=x<‘& pow(10,Variable1) ,pow(10,floor(log10(Dimension),Variable1)) &'<=x<‘ &pow(10,ceil(log10(Dimension),Variable1))
) ,class(log10(Dimension),Variable1
))



- the calculated dimension option within QlikView™ is a pretty wild and powerful option, no doubt about it !
- using small data prototypes to start from is always a wise idea !
- try to “beautify” as much as possible your formulas and scripts ! (aka structure your code)
- CEIL and FLOOR are so valuable !
- saluting the LOG10() function. I kind of missed a LOG2() variation of this in some smart Gauge boundary limitations… (if anyone interested on this matter, let me know within a comment