Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variables

Guys, I am very new to Qlikview and need to get a good understanding on how to create and use variables in my application.

I am analysing our Debtors Book and we are trying to understand when the book had grown before certain migration phases or after.

So I need to create 4 phase variables that has the following expression and then I need to plot on a graph.

   if(Posting Period >='2005-01-01' and Posting Period <='2013-03-24','Phase_1',
if(Posting Period >='2013-03-25' and Posting Period <='2013-06-23',' Phase _2',
if (Posting Period >='2013-06-24' and Posting Period <='2013-08-25',' Phase _3',
if(Posting Period >'2013-08-26',' Phase _4'     

Posting Period is a field that I bring in from my QVD. Phase is a field I will need to be a dimension…

3 Replies
salto
Specialist II
Specialist II

Hello,

Your expression, in the QV script, should look like this (more or less):

if("Posting Period" >='2005-01-01' and "Posting Period" <='2013-03-24','Phase_1',

...

if("Posting Period" >'2013-08-26','Phase _4')) AS FieldName


FieldName will contain the Phase (1, 2 3  or 4). It is a field that you will be able to use as a dimension in your QV document, without changes.


Hope this helps.

Not applicable
Author

Thank you Salto...I was on the right track and you helped confirm my logic:) Much appreciated

udit_kumar_sana
Creator II
Creator II

hi,

You can  write the same expression at script level forming the field phase.

if(Posting Period >='2005-01-01' and Posting Period <='2013-03-24','Phase_1',

if(Posting Period >='2013-03-25' and Posting Period <='2013-06-23',' Phase _2',

if (Posting Period >='2013-06-24' and Posting Period <='2013-08-25',' Phase _3',

if(Posting Period >'2013-08-26',' Phase _4'     )))) as Phase

Thanks & Regards,

Udit