Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Get the Current Year In Script

Hello!  maybe this is just a simple problem for a pro like you...

I'm trying to extract  the current year (Fiscal_Year) and quarter  (Fiscal_Qtr) in my qvd file.  I use  max(Fiscal_Year)  in my where statement but did not work.  I also tried using   Fiscal_Year =date(now(),'YYYY') but still does not work...

My objective is to get the 1st day and last day of the current year and quarter so I can make a countdown for no of days  from the befinning of the current quarter  (today() - 1st day of the current year and qtr)...

I really appreciate if you could help me...

4 Replies
Gysbert_Wassenaar

You can use daynumberofyear(today()) and daynumberofquarter(today()) to calculate those numbers.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Hi!  Gesbert,

    This one works for regular calendar...But I want to compute based on Fiscal_Calendar... Like the 1st day of Fiscal Year is 09/01/2012....

               My QVD file is like this :

                      Date                   FiscalQtr            Fiscal Year

                    08/31 /2012                 4                        2014  

                    9/01/2012                    1                       2013

                       l

                       l

                       l

                    12/01/2012                   2                         2013

hope my requirement is clearer now...

Gysbert_Wassenaar

daynumberofyear(addmonths(today(),-4))

daynumberofquarter(addmonths(today(),-4))


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Gysbert,

This one will work only if the 1st day of quarter is 1...Our Fiscal Calendar varies by date...Our 1st day of the quarter does not necessarily to be 1...like for this quarter, our 1st day is 03/02/2013.