Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
Qiyanlu66
Partner - Contributor III
Partner - Contributor III

How to get last 12 months of data by using filter?

Hello everyone,

If I want to get last 12 months of data of vCurDate,

is there any way I can do this? I am not sure how to set up the range of date in the filter.

Thank you very much.

 

19 Replies
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

on the other hand...

It would be usefull to see how you create your month/year field as depending on that my suggestion may be wrong. If you used:

  • Date(Floor(MonthStart([yourdatefield]),'YYYY-MMM')) as MonthYear

or

  • Date(MonthStart([yourdatefield]),'YYYY-MMM') as MonthYear

then it should be ok. I tend to make sure that timestamp part of any date is removed that is why i always use Floor() to remove it..

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
Qiyanlu66
Partner - Contributor III
Partner - Contributor III
Author

I have tried set Numerical value is: Floor(AddMonths(monthstart(Today()),0))
But it keep gives me error meesge of :
Something went wrong with the current operation.
when I click on save button.

tbh, I'm not sure how we created our month/year field, is there any way I could check it on the nprinting side? I didn't touch the Qlik Sense part.
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi

my  apologies i should say "evaluate value" as we talking about formula here

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

regarding the field creation - you need to look at Qlik Sense application script.. or you can look at data model viewer and click on the field. Then you should see the tags which should say: numerical, timestamp, date etc.... 

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
Qiyanlu66
Partner - Contributor III
Partner - Contributor III
Author

Thank you very much, I got it work.
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Well done mate 🙂

Cheers

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
qlikuser22
Creator II
Creator II

HI. Even I have the same issue. I want to extract the last 12 months data from current month.

Example. If the current month is June. I want last 12 months data to be selected. 

Advanced Search is : =Floor(AddMonths(monthstart(Today()),-12))

I am able to get the result but not a correct one. 

Also I tried with Numeric Value is option, but it says this expression can't be accepted because its not numeric. 

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @qlikuser22 

We dont know your datamodel and how you are applying your filters... If you use filter as you say being =Floor(AddMonths(monthstart(Today()),-12)) all what you select is only single month 12 months ago...

I suggest you read post from my blog where I explain Advanced search options: https://nprintingadventures.com/2019/06/26/nprinting-filters-part-3-advanced-search/

 

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
Ruggero_Piccoli
Support
Support

Hi,

Please open a new conversation for new question. The original question is two years old and the software evolved a lot. A new question will also let you to add all details that will help us to understand and to specify the correct version lables.

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
qlikuser22
Creator II
Creator II

HI. Can you post your solution. I have the same issue as yours. Extracting last 12 months.