0

# How to Calculate the First Day of the Curr Month Prev Year

Oct 24, 2017 at 11:08 AM

33

Former Member

I need following dates in webi

First Day of the Curr Month Prev Year - 01/10/2016

Last Day of the Curr Month Prev Year-31/10/2016

First Day of the Next Month Prev Year/Curr Year - 01/11/2016/ - 01/112017

Last Day of the Next Month Prev Year/Curr Year - 30/11/2016/ - 30/11/2017

Last Day of the Year Prev Year/Curr Year - 31/12/2016/ - 31/12/2017

Need help urgently

AMIT KUMAR
Oct 24, 2017 at 11:20 AM
0

use these.

First Day of the Curr Month Prev Year -

=RelativeDate(ToDate("01/"+FormatDate(CurrentDate();"MM/yyyy");"dd/MM/yyyy");-12;MonthPeriod)

Last Day of the Curr Month Prev Year-31/10/2016

=LastDayOfMonth(RelativeDate(ToDate("01/"+FormatDate(CurrentDate();"MM/yyyy");"dd/MM/yyyy");-12;MonthPeriod))

First Day of the Next Month Prev Year/Curr Year - 01/11/2016/ - 01/112017

=RelativeDate(ToDate("01/"+FormatDate(CurrentDate();"MM/yyyy");"dd/MM/yyyy");-11;MonthPeriod)

=RelativeDate(ToDate("01/"+FormatDate(CurrentDate();"MM/yyyy");"dd/MM/yyyy");1;MonthPeriod)

Last Day of the Next Month Prev Year/Curr Year - 30/11/2016/ - 30/11/2017

=LastDayOfMonth(RelativeDate(ToDate("01/"+FormatDate(CurrentDate();"MM/yyyy");"dd/MM/yyyy");-11;MonthPeriod))

=LastDayOfMonth(RelativeDate(ToDate("01/"+FormatDate(CurrentDate();"MM/yyyy");"dd/MM/yyyy");1;MonthPeriod))

Last Day of the Year Prev Year/Curr Year - 31/12/2016/ - 31/12/2017

=RelativeDate(ToDate("31/12/"+FormatDate(CurrentDate();"yyyy");"dd/MM/yyyy");-1;YearPeriod)

=ToDate("31/12/"+FormatDate(CurrentDate();"yyyy");"dd/MM/yyyy")

Share
Former Member Oct 24, 2017 at 12:20 PM
0

Thanks Amit ,

but i dint want to hard code it .

i have attached the screeshot , i need the data based on attached format. i have a date field. I am converting it into Week.

suppose if reporting period is Oct-17 , then my general will be Jan-17 to oct 17 , direct will be nov 16 to dec 16 and flex will be Oct16.

cap4.jpg

cap4.jpg (55.5 kB)
Show 3 Share

I didn't understand what is hard coded?

Former Member
AMIT KUMAR

Amit,

I mean "31/12" is hard coded. sorry i guess i got it wrong . I attached my requirement

31/12 is hard coded because for Last Day of the Year always 31/12.only year change.