Skip to Content
avatar image
Former Member

Max Date from Calculated view in HANA Studio

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Jan 09, 2015 at 06:16 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • avatar image
    Former Member
    Jan 09, 2015 at 10:23 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • Jan 12, 2015 at 01:30 PM

    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

    Add comment
    10|10000 characters needed characters exceeded