Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Highlighted
Not applicable

Dimension buckets

Hello,

I need help with solving the following issue in my app.

Requirement:

Give users the ability to adjust grouping interval size and number of intervals through input variables.

Current:

Right now I have 1 variable which assigns the size of interval range

vIntervalSize = 10

Result -->   Dimension    

                    0-10         

                    10-20

                    20-30

                        ....

Right now the above is achieve by the following dimension script

=subfield(class(FIELDMEASURED,vIntervalSize ,'IntSize'),' ',1)&' - '&subfield(class(FIELDMEASURED,vIntervalSize ,'IntSize'),' ',5)

Goal:

vIntervalSize1 = 5   vIteration1 = 2

vIntervalSize2 = 10 vIteration2 = 4

vIntervalSize3 = 20 vIteration3  =2

Result --> Dimension

                    0-5

                    5-10

                   10-20

                   20-30

                   30-40

                   40-50

                   50-70

                   70-90

I need to be able to fit this into a single dimension expression...

Thank you,

Kostya

1 Solution

Accepted Solutions

Re: Dimension buckets

=if(FIELDMEASURED<vIntervalSize1*vIteration1, subfield(class(FIELDMEASURED,vIntervalSize1,'IntSize',0),' ',1)&' - '&subfield(class(FIELDMEASURED,vIntervalSize1,'IntSize',0),' ',5),

if(FIELDMEASURED<vIntervalSize1*vIteration1+vIntervalSize2*vIteration2, subfield(class(FIELDMEASURED,vIntervalSize2,'IntSize',mod(vIntervalSize1*vIteration1+vIntervalSize2*vIteration2,vIntervalSize2)),' ',1)&' - '&subfield(class(FIELDMEASURED,vIntervalSize2,'IntSize',mod(vIntervalSize1*vIteration1+vIntervalSize2*vIteration2,vIntervalSize2)),' ',5),

if(FIELDMEASURED>=vIntervalSize1*vIteration1+vIntervalSize2*vIteration2 and FIELDMEASURED<vIntervalSize1*vIteration1+vIntervalSize2*vIteration2+vIntervalSize3*vIteration3, subfield(class(FIELDMEASURED,vIntervalSize3,'IntSize',mod(vIntervalSize1*vIteration1+vIntervalSize2*vIteration2+vIntervalSize3*vIteration3,vIntervalSize3)),' ',1)&' - '&subfield(class(FIELDMEASURED,vIntervalSize3,'IntSize',mod(vIntervalSize1*vIteration1+vIntervalSize2*vIteration2+vIntervalSize3*vIteration3,vIntervalSize3)),' ',5))))

I've also attached a sample QVW.

3 Replies
ramoncova06
Valued Contributor III

Re: Dimension buckets

if I understood right, you could probably get this done with nested if's

another option could be using a slider Top xxx based on Slider

where the range is defined by the min and max of slider

Not applicable

Re: Dimension buckets

I have tried with nested IFs, but the result ends up having buckets overlap. While the desired outcome is that the second tier of buckets will start where the first left off.

Re: Dimension buckets

=if(FIELDMEASURED<vIntervalSize1*vIteration1, subfield(class(FIELDMEASURED,vIntervalSize1,'IntSize',0),' ',1)&' - '&subfield(class(FIELDMEASURED,vIntervalSize1,'IntSize',0),' ',5),

if(FIELDMEASURED<vIntervalSize1*vIteration1+vIntervalSize2*vIteration2, subfield(class(FIELDMEASURED,vIntervalSize2,'IntSize',mod(vIntervalSize1*vIteration1+vIntervalSize2*vIteration2,vIntervalSize2)),' ',1)&' - '&subfield(class(FIELDMEASURED,vIntervalSize2,'IntSize',mod(vIntervalSize1*vIteration1+vIntervalSize2*vIteration2,vIntervalSize2)),' ',5),

if(FIELDMEASURED>=vIntervalSize1*vIteration1+vIntervalSize2*vIteration2 and FIELDMEASURED<vIntervalSize1*vIteration1+vIntervalSize2*vIteration2+vIntervalSize3*vIteration3, subfield(class(FIELDMEASURED,vIntervalSize3,'IntSize',mod(vIntervalSize1*vIteration1+vIntervalSize2*vIteration2+vIntervalSize3*vIteration3,vIntervalSize3)),' ',1)&' - '&subfield(class(FIELDMEASURED,vIntervalSize3,'IntSize',mod(vIntervalSize1*vIteration1+vIntervalSize2*vIteration2+vIntervalSize3*vIteration3,vIntervalSize3)),' ',5))))

I've also attached a sample QVW.