Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Year to Date

The function "inyeartodate" returns true if date lies inside the part of year containing basedate.

How can I create a flag so that YTD is last day of preceeding month?

For example, if today is 7/17/2012, "inyeartodate" includes 1/1/2012 to 7/17/2012.

I need YTD to be 1/1/2012 to 6/30/2012.

7 Replies
cesaraccardi
Specialist
Specialist

Hi, I dont know if I understood correctly... But if you want the yesterday date you can use Date(Today() - 1), Qlikview is suficiently smart to calculate it correctly.

Regards,
Cesar

nagaiank
Specialist III
Specialist III

Use the following expression to test if TestDate in in-year-to-date:

InYearToDate(TestDate,'06/30/2012',0)

This will return true(-1) or false(0).

MayilVahanan

Hi,

    

     Try like this,

              

               =if(InYearToDate('1/1/2012',MonthEnd(Today(),-1),0),1,0)

          Can you mark as right or helpful answer , which satisfyyour requirement, That other also know the solution for it..

         

Hope it helps

    

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
cesaraccardi
Specialist
Specialist

Sorry, I did'nt notice you were talking about the last date of the previous month... for this you could try:

Date(Makedate(1,Month(Today(),Year(Today())-1)

By doing this you create the first date of the current month and select the previous date.

Not applicable
Author

Thank you

Not applicable
Author

Thank you

Not applicable
Author

Thank you

I used the following:

Date(MakeDate(Year(Today()),Month(Today()))-1)

For today’s date (7/18/2012), this returns 6/30/2012, exactly what I needed.