cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to calculate the Median using one or multiple calculated columns in SAP HANA calculation views?

Former Member
0 Kudos

Hi!

This is my first time posting in the community so if this is out of topic please let me know. I was asked by a client to make a report which includes calculating the Median for a set of data. Has someone found a way to do this calculation using just tools from SAP HANA calculation views? I would need to do it within the view and just output the result as a column.

One way I thought could work would be to use a Rank node and split it in half but since I cannot use a variable as the Rank's Treshold this option is not viable. Or is it? Is there a way to make the Rank's Treshold variable?

Thank you all in advance for your help.

Regards,

Juan

Accepted Solutions (0)

Answers (1)

Answers (1)

lbreddemann
Active Contributor
0 Kudos

Why don't you simply just create a table function easily instead? In it you can handily use SQL which provides a practical MEDIAN aggregation function.

Simpels!

Former Member
0 Kudos

Hi Lars, thank you for your reply.

The problem with using a table function is that our front-end is designed to consume HANA calculation views from a repository, so defining a custom function and have the median calculated on runtime is actually not a viable option right now. Is that what you were suggesting or I missinterpreted you?

Best regards,

Juan

lbreddemann
Active Contributor
0 Kudos

Ok...

  • table functions can be created in the repository.
  • table functions can be encapsulated into common calc. views.
  • why can't your front end simply create a SELECT median(<column>)?