cancel
Showing results for 
Search instead for 
Did you mean: 

Subtract 30 days from due date

sk_kamaruzzaman
Participant
0 Kudos

Hi ,

I have a vendor payment Date format yyyymmdd 20151231 ( NVARCHAR - 8 length ) .

If the vendor will pay bfore 30 days ,company will give some offer.

So I need the findout the gross payment date which is ( actual payment Date - 30 days ). it should be 20151231- 30 = 20151201

I have created one calculated column with formula adddays(date,int) , adddays("paymentDate",-30) .

This function is not working . Please suggest any other option is there.

I can able to add 30 days which is working fine but not able to deduct 30 days from the paymentDate.

Regards,

Kamruz

Accepted Solutions (0)

Answers (1)

Answers (1)

Loed
Active Contributor
0 Kudos

Hi,

Where do you do this in BW? Can you assign a variable instead of number?

Say, you assign -30 to temporary variable..

TEMP_VAR = 1 - 31.

ADDDAYS("paymentDate",TEMP_VAR).

Regards,

Loed

sk_kamaruzzaman
Participant
0 Kudos

Thanks for the reply.

I want to see in HANA calculation view.

I have the date column in report  format 20151231. I want to add one more column which will be 20151231-30 days = 20151201 in report.

I have joined this date with M_TIME_DIMESION table and pick DATE_SQL.

After that I created one calculated column with formula DATE_SQL-30= > This  is working fine and data also showing 30 days less from that date.

Is it possible by creating calculated column without joining any new table ?

Regards,

Kamruz

patrickbachmann
Active Contributor
0 Kudos

You should be able to do this by converting it from NVARCHAR(8) to a date format like this;

add_days(TO_DATE(DATE_SQL),-30)

-Patrick