Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Creating a Slider

Hi Community

I have created a stacked bar chart with  Q3 2013, Q4 2013, Q1 2014, Q2 2014, Q3 2014, Q4 2014. on the x Axis  showing  SLA Costs, IT charges, Dual Running, Implementation and Run Costs. I want to create a slider,in  which when I click on Q3 2013 on the slider, the since work is done for 2013 , the bar chart should only show the data  from Q4 2013 to Q4 2014. And then when I click on Q4 2013 on the slider, since the work is done for Q3 2013 and Q4 2013, the bar chart should reflect the  data from  Q1 2014 to Q4 2014 and so on. I mean the same applies to rest of the quarters. And when I click on Q4 2014, since all the work has been done by then, the bar chart should not show any data. So the bar chart should be inversely proportional to the slider. Can any one tell me how to create this in Qlikview?

Tags (1)
1 Solution

Accepted Solutions
fred_s
Contributor III

Re: Creating a Slider

I hope you know what you're doing with FornaxRuncosts etc

The only thing I did was editing you're code :-)

Grtz Fred

tmp:

LOAD * INLINE [

    Q, FornaxRunCost, DualRunning, SLACosts, RocheITCharges, Implementation

    "    Q3 2013, 10,10,10,10,10", 10, 10, 10, 10, 10

    "    Q4 2013, 2,2,2,2,2", 2, 2, 2, 2, 2

    "    Q1 2014, 3,3,3,3,3", 8, 8, 8, 8, 8

    "    Q2 2014, 4,4,4,4,4", 4, 4, 4, 4, 4

    "    Q3 2014, 5,5,5,5,5", 5, 5, 5, 5, 5

    "    Q4 2014, 6,6,6,6,6", 6, 6, 6, 6, 6

    "    Q1 2015, 7,7,7,7,7", 2, 2, 2, 2, 2

    "    Q2 2015, 8,8,8,8,8", 8, 8, 8, 8, 8

    "    Q3 2015, 9,9,9,9,9", 9, 9, 9, 9, 9

    "    Q4 2015, 10,10,10,10,10", 10, 10, 10, 10, 10

];

mydata:

Load *,

       (Qyear * 4) + right(Qsub,1) as Qno,

    (Qsub * 3) + right(Qsub,1) as [DurationFornaxRunCost],

    (Qsub * 4) + right(Qsub,1) as [DurationDualRunning],

    (Qsub * 2) + right(Qsub,1) as [DurationSLACosts],

    (Qsub * 5) + right(Qsub,1) as [DurationRocheITCharges],

    (Qsub * 6) + right(Qsub,1) as [DurationImplementation],

     Qyear & '-' & Qsub  as vDurrev,

     Qsub & '-' & Qyear as vDuration

     ;

  

Load *,

    mid(trim(Q), 1, 2) as Qsub,

    mid(trim(Q), 4, 4) as Qyear

Resident tmp;

Drop table tmp;

// Do not edit after this line, other than adding new Quarter

Qtemp:

Load * INLINE [

vQno, vQlong

8054, 2013-Q2

8055, 2013-Q3

8056, 2013-Q4

8057, 2014-Q1

8058, 2014-Q2

8059, 2014-Q3

8060, 2014-Q4

8061, 2015-Q1

8062, 2015-Q2

8063, 2015-Q3

8064, 2015-Q4

];

18 Replies
fred_s
Contributor III

Re: Creating a Slider

Hi Smriti,

Have a look at the attachment.

I've created an absolute Quarter value

(year * 4) + q

'2000 Q2' = (2000 * 4) + 2 = 8002

and created an Island with the same values (as vQno and vQlong).

The slider is using the Island.

The graph has a calculated dimension:

=if(Qno >vQno, Qlong, null())

Grtz Fred

Not applicable

Re: Creating a Slider

Hi Fred

Thanks for the reply. But since I am using the personal edition on my system, I am not able to open your qvw file.

Is it possible for you to copy/paste the script. It will be very helpful.

Thanks once again,

Smriti

fred_s
Contributor III

Re: Creating a Slider

This is the script I've used, but you'll have to tune it to your needs:

tmp:

Load * INLINE [

Q, Amount

Q3 2013, 1

Q4 2013, 2

Q1 2014, 3

Q2 2014, 4

Q3 2014, 5

Q4 2014, 6

];

mydata:

Load *,

    (Qyear * 4) + right(Qsub,1) as Qno,

    Qyear & '-' & Qsub as Qlong

;

Load *,

    left(Q, 2) as Qsub,

    right(Q, 4) as Qyear

Resident tmp;

Drop table tmp;

Qtemp:

Load * INLINE [

vQno, vQlong

8055, 2013-Q3

8056, 2013-Q4

8057, 2014-Q1

8058, 2014-Q2

8059, 2014-Q3

8060, 2014-Q4

];

fred_s
Contributor III

Re: Creating a Slider

The slider is a single value with field vQlong.

My Graph has a calculated dimension

=if(Qno >vQno, Qlong, null())

slider-graph.JPG

Not applicable

Re: Creating a Slider

Hi Fred

Your qvw file was very helpful. I have analysed your file. You have created a simple bar chart. But I am trying to create a stacked chart Before adding a calculated dimension, itweas going well. The output was like this:

Not applicable

Re: Creating a Slider

But after I add the calculated dimension  which is

=if(DurationFornaxRunCost> FornaxRunCost, vDuration, null()), the output is like this:

I mean  why is the  graph changing after adding the calculated dimension. T slider is calculating well. But I want to present the graph as per previous screenshot. Can you guide me again.

fred_s
Contributor III

Re: Creating a Slider

1. Is it possible to share your file?

2. Why is your quarter looking like this ,3,3-Q1 (Languagesettings? Codepage?)?

Not applicable

Re: Creating a Slider

Yes Fred. This is my file. Mine is a personal edition. So let me know if you cannot open it. I will copy paste the script here.

Smriti

fred_s
Contributor III

Re: Creating a Slider

Opening your file is no problem, but I'll have to look into to it this evening (probably in 5 or 6 hours).

I'm on a job right now.

I'll get back to you in a couple of hours.

Grtz Fred

Community Browser