cancel
Showing results for 
Search instead for 
Did you mean: 

Max Date from Calculated view in HANA Studio

Former Member
0 Kudos

I am trying to create some calculated key figures in an calculated view in Hana Studio using this type of logic:

Need to aggregate the key figure based on the last 12 months of data.

For example if the Last month loaded is 11/2014

Then I want to aggregate from 11/2014 to 12/2013.

My problem is in how to figure out the last_loaded date from the overall model.

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member182302
Active Contributor
0 Kudos

Not sure if you have already tried this:

Did you try having the "Aggregation" node with "Date" column with MAX as the aggregation type?

Additional links:

Regards,

Krishna Tangudu

Former Member
0 Kudos

I found a way that describe using Ranking in a Graphical view.  I will try the same using Max Date to see if I can implement this solution.

http://scn.sap.com/docs/DOC-56421

sreehari_vpillai
Active Contributor
0 Kudos

If you do so, it will lead to performance issues for sure. Why couldn't you try scripted calculation view, if you are not able to achieve the max functionality otherwise ?

Sree

Former Member
0 Kudos

Thanks Sree,

Tried to use the Scripted calculation view, but could not find great examples in how to use the variables when I would set the Max Date or other parameters.  I'm sure that it is a syntax problem.  I saw one reply for a similar problem showing how to accomplish the ranking issue three ways in HANA studio:

http://scn.sap.com/community/hana-in-memory/blog/2014/01/10/sap-hana-ranking-using-graphical-calcula...

sreehari_vpillai
Active Contributor
0 Kudos

For your c
se, better if you use a scripted calculation view specific to the max functionality and other related functionalities. Then you can use the same scripted calc view into your business logic(may be a another calc view) . Using the rank calculation method for this scenario is not a perfect deal . If  you are facing syntax errors in achieving it, share the snippet to us, after checking online documentation/

Sree

vivekbhoj
Active Contributor
0 Kudos

Hi Jeff,

To find max date, use below query:

SELECT MAX(Date Field) FROM TABLE and you will get the max date


In Calculation View, you can create a Calculated Column say "MAX" as MAX(Date Field) to get max date

Regards,

Vivek

Former Member
0 Kudos

Vivek,

Thanks for your response. I understand how to get to a max date in a select statement from a table.  I will try to clarify.

I have a calculated view that has two tables one for netsales that is load monthly and one that has a yearly tally for overall volumes of product sold.  I need to have a aggregation of the netsales based on the last month loaded and the previous twelve months.  I tried to use the now function to figure out what my date is and work backwards from there but since the business might not have December numbers loaded then I need to see that November 2014 was the last month loaded.  I realize that HANA studio might not be were I want to do this and I can do this in the reporting tool but I run into performance issue in the reporting tool so I thought I would start in Studio first.

Thanks

Jeff