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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
alkesh_sharma
Creator III
Creator III

Set Analysis for Nested loop

Hello,

Can anybody please tell me the set analysis statement for nested loop.

10 Replies
sujeetsingh
Master III
Master III

Yup

SUM(if(Brand='LEVIS',QTY)) now for this statement you can write set expression

sum({$<Brand={'LEVIS'} >} QTY) 

This just for reference you can similarly go for the nested if

Not applicable

What do you mean by 'loop'?

alkesh_sharma
Creator III
Creator III
Author

Thankyou Sujeet for the quick response, It would be great if you have help me out a lil in detail.

I need the exact Set analysis statement for the below nested if:

If([Rolling Month] = 'Apr - 2005',1,

If([Rolling Month] = 'May - 2005',2,

If([Rolling Month] = 'Jun - 2005',3,

If([Rolling Month] = 'Jul - 2005',4,

If([Rolling Month] = 'Aug - 2005',5,

.

.

.

.

.

.

If([Rolling Month] = 'Mar - 2010',60,))))))

Not applicable

Add a column with 1, 2, 3 .... for each Rolling Month

and use it

Fabrice

alkesh_sharma
Creator III
Creator III
Author

Thankyou but this will not solve my problem. I would need to write 60 rolling month as per your answer.

alkesh_sharma
Creator III
Creator III
Author

I need the exact Set analysis statement for the below nested if:

If([Rolling Month] = 'Apr - 2005',1,

If([Rolling Month] = 'May - 2005',2,

If([Rolling Month] = 'Jun - 2005',3,

If([Rolling Month] = 'Jul - 2005',4,

If([Rolling Month] = 'Aug - 2005',5,

.

.

.

.

.

.

If([Rolling Month] = 'Mar - 2010',60,))))))

Not applicable

With this column (or any expression that returns 1 to 60 for the rolling months), you avoid all these nested if()

What do you want to do ?

1) to do a nested complicated thing whatever the result ?

2) return a Number for a given Rolling Month ? and insert it into another expression ? use it as a dimension ?

Fabrice

alkesh_sharma
Creator III
Creator III
Author

I want to use it as a dimension. creating a column is a hectic task but would definitely solve the purpose. I am looking for something that would reduce the length of script.

Not applicable

in the script, use functions like

rowno(), autonumber(), autonumberhash128 or 256()

in the UI (Calculated Dimension), you can use also a function like FieldIndex('Field', Field) to get sth numbered from 1 to the number of values (according to the FIRST load order).

Fabrice