cancel
Showing results for 
Search instead for 
Did you mean: 

Setup Date period.

marek_moravcik
Explorer
0 Kudos

Hallo SAP support.

Please help me.

Every month when I refresh report I must manually change date from the beginning of the year to the end of the last month:

1.1.2018 - 31.1.2018

1.1.2018 - 28.2.2018

1.1.2018 - 31.3.2018

Now it will by: 1.5.2018

Question:

Exist date period from the beginning of the year to the end of the last month?:

now I need: 1.1.2018 - 30.4.2018 so I do not have to manually change?

"YearToDate" is probably not correct,

thanks for help

marek

Accepted Solutions (1)

Accepted Solutions (1)

DellSC
Active Contributor
0 Kudos

I'm going to assume that you're not using parameters for this - there's no way to do this with parameters. However, there is a way to do it with a couple of formulas:

{@FirstOfYear}

if Month(CurrentDate) > 1 then Date(Year(CurrentDate), 1, 1) else Date(Year(CurrentDate) - 1, 1, 1)


{@LastMonthEnd)

if Month(CurrentDate) > 1 then Date(Year(CurrentDate), Month(CurrentDate), 1) - 1 else Date(Year(CurrentDate) - 1, 12, 31)

Then you'll need to modify the formula in the Select Expert by hand to include something like this for your dates:

{MyTable.DateField} >= {@FirstOfYear} and {MyTable.DateField} <= {@LastMonthEnd}

Note that these formulas are set up to roll from year to year as well as from month to month so you won't have to edit them for a new year as well as for a new month.

-Dell

Answers (2)

Answers (2)

marek_moravcik
Explorer
0 Kudos

thanx many thanx really Dell Stinnett-Christy

marek_moravcik
Explorer
0 Kudos

Thanks Christy, You helped me.

Yes, That's exactly what I am looking for. If you allow 1 question.

Somethimes I need this date period: {@Last12month} for example: 1.5.2017 - 30.4.2018

30.4.2018 = {@LastMonthEnd) ok I understand, but how define 1.5.2017 ?

if this refresh this month the period must be 1.5.2017 - 30.4.2018

if this refresh next month the period must be 1.6.2017 - 31.5.2018 etc...

THANKS for solutions

DellSC
Active Contributor
0 Kudos

Again, this is not difficult if you use {@LastMonthEnd}:

{@Period Begin}

DateAdd("yyyy", -1, {@LastMonthEnd}) + 1

This will subtract a year from the end of last month and then add one day to get the first day of the month 12 months ago.

-Dell