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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
NavinReddy
Creator II
Creator II

How to get three months

Hi Dear Experts,

I have month column in my fields list.

Here based on Month selections i have to display three Consecutive Months in pivot table

Here is my Month filed Current im using "Month(MonthStart(Date(Mid([MTRC_FCT_DT],1,8)))) as Month"

Any suggestions how to achieve this

Ex:

if Month= Jan (Month-2, Month-1,Month)

    O/P= Nov, Dec,Jan

if Month= Feb (Month-2, Month-1,Month)

    O/P= Dec,Jan, Feb

if Month= Mar, (Month-2, Month-1,Month)

    O/P= Jan, Feb,Mar

Best Regards,

Niranjan

13 Replies
NavinReddy
Creator II
Creator II
Author

Thanks Gysbert

NavinReddy
Creator II
Creator II
Author

Hi Gysbert,

Please help me below if condition im not getting exact Month selections

for all the months im getting exact same result, please suggest me where im doing wrong

   vMonth: =if(len(GetCurrentSelections()),max(MonthYear),MonthStart(Today()))

=if(Date($(vMonth),'MMM YY'),      if ((RAG_RATING_CD) = 'R', 'Tier1',

                                                  if ((RAG_RATING_CD) = 'A', 'Tier2',

                                                  if ((RAG_RATING_CD) = 'G', 'Tier3'))),

                               

if(Date($(vMonth)-10,'MMM YY'),    if ((RAG_RATING_CD) = 'R', 'Tier1',

                                                    if ((RAG_RATING_CD) = 'A', 'Tier2',

                                                    if ((RAG_RATING_CD) = 'G', 'Tier3'))),

                               

if(Date($(vMonth)-50,'MMM YY'),   if ((RAG_RATING_CD) = 'R', 'Tier1',

                                                  if ((RAG_RATING_CD) = 'A', 'Tier2',

                                                  if ((RAG_RATING_CD) = 'G', 'Tier3'))))))

Best Regards,

Niranjan

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Please start a new discussion that explains what you're trying to do. I have no idea what that is.


talk is cheap, supply exceeds demand
NavinReddy
Creator II
Creator II
Author

Hi Gysberrt,

Good Morning,

Here the query i have posted, i tried with different ways but im not getting

based on MonthYear selections for three months im calculating the Tiers

But all months im getting the same result

for your reference i have attached sample application

month variable not working For all months i got the same results

Best Regards,

Niranjan