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

Announcements
Register by January 31 for $300 off your Qlik Connect pass: Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Prior month and value loop error

All,

Would appreciate feedback on the following scenario. I have created a Dimension using Value Loop and would like to have it dynamically name the last twelve months from today's date(-1). Below is the set analysis I put together to accomplish this, however, it loses three months(Jan-Mar). Unsure of why.

    Missing Months                         

Need

1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

Even your expression seems to work.

=ValueLoop(1,12) Pick(ValueLoop(1,12), Month(AddMonths(Today(),-1)), Month(AddMonths(Today(),-2)), Month(AddMonths(Today(),-3)), Month(AddMonths(Today(),-4)), Month(AddMonths(Today(),-5)), Month(AddMonths(Today(),-6)), Month(AddMonths(Today(),-7)), Month(AddMonths(Today(),-8)), Month(AddMonths(Today(),-9)), Month(AddMonths(Today(),-10)), Month(AddMonths(Today(),-11)), Month(AddMonths(Today(),-12)) )
 
1Sep
2Aug
3Jul
4Jun
5Mai
6Apr
7Mrz
8Feb
9Jan
10Dez
11Nov
12Okt

Seems like there is something different in your setting, so please post a sample QVW

View solution in original post

4 Replies
swuehl
Champion III
Champion III

Seems to work for me:

=ValueLoop(1,12) Month(AddMonths(Today(),-ValueLoop(1,12)))
 
1Sep
2Aug
3Jul
4Jun
5Mai
6Apr
7Mrz
8Feb
9Jan
10Dez
11Nov
12Okt
swuehl
Champion III
Champion III

Even your expression seems to work.

=ValueLoop(1,12) Pick(ValueLoop(1,12), Month(AddMonths(Today(),-1)), Month(AddMonths(Today(),-2)), Month(AddMonths(Today(),-3)), Month(AddMonths(Today(),-4)), Month(AddMonths(Today(),-5)), Month(AddMonths(Today(),-6)), Month(AddMonths(Today(),-7)), Month(AddMonths(Today(),-8)), Month(AddMonths(Today(),-9)), Month(AddMonths(Today(),-10)), Month(AddMonths(Today(),-11)), Month(AddMonths(Today(),-12)) )
 
1Sep
2Aug
3Jul
4Jun
5Mai
6Apr
7Mrz
8Feb
9Jan
10Dez
11Nov
12Okt

Seems like there is something different in your setting, so please post a sample QVW

Not applicable
Author

Stefan,

Thanks for the quick response, are you using the below as the expression?

pick(ValueLoop(1,12),Month(AddMonths(Today(),-ValueLoop(1,12))))

Not applicable
Author

I checked settings and had a restriction on my dimension that was limiting it. Thank you for your input and the much shorter syntax! Can you recommend any resources for becoming proficient at set analysis or is more or less learned through experience?