Is there a way to find last date of month using any function? Like 03/15/2017 should return 03/31/2017? (SAP)

SAP HANASAPSAP Basis

You can try using DateSerial() function.

DateSerial returns a Date value for the specified year, month and day. It also handles relative Date expressions.

Arguments

  • year is a whole Number or numeric expression representing a year, example: 1996.
  • month is a whole Number or numeric expression representing a month, example: 12 for December.
  • day is a whole Number or numeric expression representing a day of the month, example: 5.

Returns

A Date value.

Action

DateSerial returns a Date value for the specified year, month and day. It also handles relative Date expressions.

DateSerial (2000, 6, 15)

DateSerial (2004, 1 - 7, 15)

DateSerial (2008, 1, 166)

Check the below code as it finds the first day of next month and then you can go back one day back to get last date of month.

DateSerial
(
   year({table.date},
   month({table.date}) + 1,
   1 - 1 ;
)

You can refer this link to know more about this function −

DateSerial

raja
Published on 06-Dec-2017 19:40:59
Advertisements