cancel
Showing results for 
Search instead for 
Did you mean: 

How to Calculate column (Month, Year) from date or timestamp

KulDeepJain
Active Participant
0 Kudos

Hi,

NameSQL Data TypeDimensionColumn Store Data TypeKeyNot NullDefaultComment
T_STAMPTIMESTAMP
LONGDATE



How to generate Month and Year from timestamp field in Analytic View.

Please provide me some valuable input. I have searched SCN before posting this discussion.

Accepted Solutions (1)

Accepted Solutions (1)

shyam_uthaman
Participant
0 Kudos

Try this method.. Just created an article for this after reading your question

Answers (2)

Answers (2)

KulDeepJain
Active Participant
0 Kudos

Hi Shyam and Krishna,

Thanks for your inputs, I have one doubt here:

Here we are generating Year and Month as data type of string.

If we compare same with BI (0CALMONTH & 0CALYEAR). we can do use offset functionality but I hope we same we can't do same now in HANA.

Thanks,

KD J

former_member182302
Active Contributor
0 Kudos

Hi KD,

Offset is the property of Bex Query designer right

I think BO WebI has also something similar to this ( Not sure though )

Converted to String so that i can apply string operation to split the required value. You can again cast this into integer and take the offset value ( either hardcoded or from input parameter) and add it to the value.

But again depends on your logic on how you want to add or subtract.

Regards,

Krishna Tangudu

former_member182302
Active Contributor
0 Kudos

Hi KD,

You can apply the following formulas in the expression:

For Year :

leftstr(string("Timestamp"),4)

For Month:

midstr(string("Timestamp"),6,2)

Regards,

Krishna Tangudu