0 Replies Latest reply: Oct 28, 2011 12:08 AM by Kamal Naithani

# Query

I am having one query. The lines that I am pasting here is most frequently

used here but I am not understand this logic. So can you elaborate the

output coming from this. Basically I want to be clear about YTD and MTD

functions. Here:

Year = 2011, 2012

Month = 1,2,3,4,....,12

Maxdate = Date(today()-1,'YYYY-MM-DD')

.         Here I am having 1 doubt that the date format of Maxdate is

YYYY-MM-DD but at other places we are using date format as dd/mm/yyyy.

FiscalMonthStart = 4

If(InYearToDate (date(makedate(Year,Month,1),'dd/mm/yyyy'),'\$(MaxDate)',

0,\$(FiscalMonthStart)),1,0) as [TYTD  Flag Budget],  //   Current Year to

Date this Year

If(InYearToDate (date(makedate(Year,Month,1),'dd/mm/yyyy'),'\$(MaxDate)',

-1,\$(FiscalMonthStart)),1,0) as [LYTD  Flag Budget], //  Last Year to Date

this Year

If(InYear (date(makedate(Year,Month,1),'dd/mm/yyyy'),'\$(MaxDate)',

-1,\$(FiscalMonthStart)),1,0) as [LY  Flag Budget],         // All Dates Last

Year

//******************Month

Flag******************************************************************

If(InMonthToDate(date(makedate(Year,Month,1),'dd/mm/yyyy'),'\$(MaxDate)',

0,\$(FiscalMonthStart)),1,0) as [TY CMTD Flag Budget], //   Current Month to

Date this Year

If(InMonthToDate(date(makedate(Year,Month,1),'dd/mm/yyyy'),'\$(MaxDate)',

-1,\$(FiscalMonthStart)),1,0) as [TY PMTD Flag Budget] //  Previous Month to

Date this Year