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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Fetch previous 12 months data from current month selection

Hi All

I am having trouble in fetching the previous 12 months data in the bar chart. I have written the following query:

=count({1}{<M_Month={"<=$(vCurrentSelectionMonth)"},[Action Category]={'Leavers'}>}[Number of Actions])

I want to fetch the previous 12 months data as per my current month selection.

Suppose, I am selecting Oct 2016 month then it should show me data in the bar chart from Nov 2015 to Oct 2016.

PFA images for more details.

Thanks in advance

3 Replies
sunny_talwar

What is your M_Month field format? Also, you have {1} at the incorrect location

=Count({1}{1<M_Month = {"<=$(vCurrentSelectionMonth)"}, [Action Category] = {'Leavers'}>}[Number of Actions])

Anonymous
Not applicable
Author

Format for M_Month is "MMM" ie. Jan, Feb, Mar

sunny_talwar

and how is vCurrentSelectionMonth defined? I would suggest creating a numerical Month field in the script.

Num(M_Month) as Num_M_Month

and use that in your expression