Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Author

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

View solution in original post

3 Replies
Not applicable
Author

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
Author

ah, so "easy" 😃 Thanks!

Not applicable
Author

Yes sometimes 😃