cancel
Showing results for 
Search instead for 
Did you mean: 

New Calculated column for field ARBEH ( Unit for work )

former_member254442
Participant
0 Kudos

Hi All,

In transaction data ,value for field # ARBEH varies such as MIN,DAY,SEC,HR . My requirement is to create a calculated column(eg. ARBEH_HOUR)  which will be always in HR . How can I write this expression ? Eg.( if ARBEH is MIN then ARBEH_HOUR should be equal to ARBEH/60 or if ARBEH is SEC then ARBEH_HOUR should be equal to ARBEH/3600 ) . Pleas let me know how can I write this logic on HANA Studio . Thanks in advance .

Best Regards,

Pranjal

Accepted Solutions (1)

Accepted Solutions (1)

pfefferf
Active Contributor
0 Kudos

Hello Pranjal,

the differentiation for the calculation can be done using the "if" or the "case" function (Miscellaneous Functions - SAP HANA Modeling Guide for SAP HANA Web Workbench - SAP Library).

But the question is, if you you have the unit information anywhere in your data record. What you described above ARBEH contains a number, either minutes, days ..., cause you are using it in the sample applications. Where is the information if e.g the 100 are days or minutes or something else?

Regards,

Florian

former_member254442
Participant
0 Kudos

HI

Thanks for your response . Yes, I have value field ( ARBEI) in another column. My final goal is to get value of field ARBEI always in unit ( ARBEH) of "HR" . Unit(ARBEH) varies ,sometimes mint, sec.Hr or day .  As I am new to this area, could you please let me know how can I write this expression using if or case functionality . Thanking you .

pfefferf
Active Contributor
0 Kudos

For instance.

CASE("ARBEH", 'MIN', "ARBEI"/60, 'SEC', "ARBEI"/3600, '')

Just follow the documentation in the link provided above.

former_member254442
Participant
0 Kudos

Thanks .

former_member254442
Participant
0 Kudos

Hi Florian, I am getting error message as attached ( varaibale "MIN" is not defined ) . I know variable can be defined at semantic node but my requirement is to define at table level itself since system has to dynamically calculate .

pfefferf
Active Contributor
0 Kudos

MIN is not column, but a value. You have to enclose it in single quotes, not double quotes (as shown above).

former_member254442
Participant
0 Kudos

Hi

Still I am getting some error as attached .

pfefferf
Active Contributor
0 Kudos

What type has your field "ARBEI"?

former_member254442
Participant
0 Kudos

Data type of ARBEI  is QUAN  & ARBEH is UNIT .  Even after converting both these fields data type as " DECIMAL" ,I am getting error message as attached .

former_member254442
Participant
0 Kudos

Thanks

Answers (0)