cancel
Showing results for 
Search instead for 
Did you mean: 

how to get 1st day for a given month and year in calculation view in sap hana

Former Member
0 Kudos

how to get 1st day for a given month and year in calculation view using Input parameter

pfefferf
Active Contributor
0 Kudos

What information you wanna have here, the date, the spoken day, ...?

Please share also what you have tried so far, instead of just posting your spec dump.

Regards,
Florian (Moderator)

Former Member
0 Kudos

for example by giving month and year as dec 2017 the output will have to be 1st day of december using input parameter.

Accepted Solutions (1)

Accepted Solutions (1)

pfefferf
Active Contributor
0 Kudos

Ok, if I understood you right you have an input parameter for the month and an input parameter for the year and you wanna create the date for the month/year starting on the 1st, for further usage in your CV.

An option would be to use a third input parameter which is set to "Derived from Procedure/Scalar functions". With that you can create a procedure or scalar function which is mapped to the third parameter. The procedure/scalar function has two input parameters, month and year, to which the existing input parameters month and year of the calc. view are mapped. The output of the procedure/scalar function is the calculated date (I think you are able to create the logic by yourself).

So with that, wenn you enter a month and year in the calc. view parameters and execute the calc. view, the third parameter is filled with the calculated date. The "calculated" input parameter can be used in your calc. view as every other input parameter.

Regards,
Florian

Answers (1)

Answers (1)

0 Kudos

capture.png

Create 2 input parameters based on Year and Month taking reference columns from View and create a calculated column with the below expression:

if("MONTH"='$$IP_MONTH$$' and "YEAR"= '$$IP_YEAR$$','01'+ '/'+'$$IP_MONTH$$'+'/'+'$$IP_YEAR$$','0')