Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

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

Help with nested IF

Hi

Can somone help me to add the first if statment to the second?

if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) as PERIOD,

if(right(PERIOD,1) = 1, mid(PERIOD,3,2) & '/' & num(mid(PERIOD,3,2)+1, 00) & ' HT',  if(match(right(PERIOD,1),'2','3','4','5','6'), mid(PERIOD,3,2) & '/' & num(mid(PERIOD,3,2)+1, 00) & ' VT')) as Termin_Org,

The source are in the following pattern so I have to formate it by the first if-formula before I can use the second. Thats why I want to include it in the second.

LOAD * INLINE [  

PERIOD     

20091   

20092   

20101   

20102   

111   

112   

121   

];

1 Solution

Accepted Solutions
Not applicable

Re: Help with nested IF

Hi,

it's easy. You have to rewrite every PERIOD in the second statement with the first if-clause.

if

(right(if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) ,1) = 1,

mid(if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) ,3,2) & '/' &

num(mid(if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) ,3,2)+1, 00) & ' HT', 

if(match(right(if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) ,1),'2','3','4','5','6'),

mid(if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) ,3,2) & '/' &

num(mid(if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) ,3,2)+1, 00) & ' VT'))

Then you would become the following values:

period.jpg

I have only load in your data and put your expressions in a sum-table.

The first expression is your first if-statement.

The second one is your second if-statement.

And the third one is the combining expression see above.

Hope this is, want you want to see.

Regards vicky

3 Replies
Not applicable

Re: Help with nested IF

Hi,

it's easy. You have to rewrite every PERIOD in the second statement with the first if-clause.

if

(right(if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) ,1) = 1,

mid(if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) ,3,2) & '/' &

num(mid(if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) ,3,2)+1, 00) & ' HT', 

if(match(right(if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) ,1),'2','3','4','5','6'),

mid(if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) ,3,2) & '/' &

num(mid(if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) ,3,2)+1, 00) & ' VT'))

Then you would become the following values:

period.jpg

I have only load in your data and put your expressions in a sum-table.

The first expression is your first if-statement.

The second one is your second if-statement.

And the third one is the combining expression see above.

Hope this is, want you want to see.

Regards vicky

Not applicable

Re: Help with nested IF

ah, so "easy" =) Thanks!

Not applicable

Re: Help with nested IF

Yes sometimes =)

Community Browser