Skip to main content
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
podge2019
Contributor III
Contributor III

Year to Date Variable minus current Month

Hello,

I'm looking for assistance to either create a variable for QlikView or have a filter that will work on NPrinting for getting the current year to date minus the current month.

Currently I have a filter that does the current YTD and includes the current months data -> Let vCurrentFiscalYear = num(YearStart(Today())); // Current Year.

I have tried a few variations from the forums on both QlikView (by creating a new variable) and NPrinting.

Would anyone be able to assist please.

These are the current other variables in my script.

Thanks.

podge2019_0-1599738093553.png

 

Labels (2)
3 Solutions

Accepted Solutions
jwjackso
Specialist III
Specialist III

For the NPrinting filter, use the advanced search

=YOUR_DATE_FIELD_HERE >= YearStart(Floor(Today())) and YOUR_DATE_FIELD_HERE < MonthStart(Floor(Today()))

 

View solution in original post

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @jwjackso 

As much as your expression will work I'd like to argue on why would you use Floor in the places you have used it?

Floor() removes decimal points, so in case of dates it removes time part of date/timestamp. Now as soon as you introduce functions like MonthStart or MonthEnd or YearStart, YearEnd you will get back timestamp part, but here is a trick. YearStart and MonthStart will put it back to the same value as Floor() function does, but if you were to use MonthEnd or YearEnd functions you will get back date&23:59:59 timestamp. Thats it why if anything it only makes sense to put Floor ahead of your month/year start formulas despite the fact that in this case it is completel reduntant:

=YOUR_DATE_FIELD_HERE >= Floor(YearStart(Today())) and YOUR_DATE_FIELD_HERE < Floor(MonthStart(Today()))

instead of:

=YOUR_DATE_FIELD_HERE >= YearStart(Floor(Today())) and YOUR_DATE_FIELD_HERE < MonthStart(Floor(Today()))

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.

View solution in original post

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

@podge2019 

in NPrinitng use Advanced Search option as per @jwjackso suggestion. You may want to look at this post with samples: 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.

View solution in original post

4 Replies
jwjackso
Specialist III
Specialist III

For the NPrinting filter, use the advanced search

=YOUR_DATE_FIELD_HERE >= YearStart(Floor(Today())) and YOUR_DATE_FIELD_HERE < MonthStart(Floor(Today()))

 

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @jwjackso 

As much as your expression will work I'd like to argue on why would you use Floor in the places you have used it?

Floor() removes decimal points, so in case of dates it removes time part of date/timestamp. Now as soon as you introduce functions like MonthStart or MonthEnd or YearStart, YearEnd you will get back timestamp part, but here is a trick. YearStart and MonthStart will put it back to the same value as Floor() function does, but if you were to use MonthEnd or YearEnd functions you will get back date&23:59:59 timestamp. Thats it why if anything it only makes sense to put Floor ahead of your month/year start formulas despite the fact that in this case it is completel reduntant:

=YOUR_DATE_FIELD_HERE >= Floor(YearStart(Today())) and YOUR_DATE_FIELD_HERE < Floor(MonthStart(Today()))

instead of:

=YOUR_DATE_FIELD_HERE >= YearStart(Floor(Today())) and YOUR_DATE_FIELD_HERE < MonthStart(Floor(Today()))

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

@podge2019 

in NPrinitng use Advanced Search option as per @jwjackso suggestion. You may want to look at this post with samples: 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.
podge2019
Contributor III
Contributor III
Author

Thanks a million @jwjackso  & @Lech_Miszkiewicz 

Put me on the right path and got the resolution.

Assistance is much appreciated.