Skip to Content

Being on an old version of SAP HANA Studio (rev 48) as compared to the server (rev 51), I was not able to access a calculated column from an analytical view in the calculation view SQL script. You also should check the definition of the Analytical view in _SYS_BIC, if it actually has the column (even if it shows it in data preview it might be missing in the definition).

Update to match the server version or higher (I updated to revision 52), reactivate the analytical view and it should show the calculated column in it’s defintion:

/wp-content/uploads/2013/03/img1_199940.png

Notice I am choosing “dsproten/SHOP_FACTS” and not “dsproten/SHOP_FACTS/olap” (which shows the same Orange Cube icon). If you can find it ending in “/olap”, you are probably on an older SAP HANA Studio version.

(Update) If you have calculated column in an Analytical View, the Analytical View will actually generate an additional Calculation View in the background with the same name, but without /olap and contain your calculated column.

Example of an Analytical View without calculated column:

/wp-content/uploads/2013/03/img2_199941.png

Now for the Analytical View (without /olap ) with calculated column “QPLUAM”:

/wp-content/uploads/2013/03/img3_199942.png

If the column is not listed, the SQLscript in a calculation view will also not see the Calculated column and throw an error.

After adding a new calculated measure in the analytical view, select “Semantics”. In this example QPLUAM. Aggregation type is set to “NONE” by default.

/wp-content/uploads/2013/03/img4_199943.png

When activating it does go through, but with a warning on validation:

/wp-content/uploads/2013/03/img5_199944.png

Change the aggregation type to FORMULA and the warning will disappear.

  /wp-content/uploads/2013/03/img6_199945.png

And you can proceed to retrieve the value in a Calculation view:

/wp-content/uploads/2013/03/img7_199946.png

   var_out = CE_OLAP_VIEW(“_SYS_BIC”.”dsproten/SHOP_FACTS”,[“STATE”,”CATEGORY”,SUM(“MARGIN”),SUM(“QPLUAM”)]);

Tip: don’t forget the output is definied at 2 levels, add your Output parameter fields created in the script definition also to the output of the calculation view.

/wp-content/uploads/2013/03/img8_199947.png

Data Preview et voilà!

Data distribution in a table

Update: 29/11/2013 (HANA rev 63)

A nice little trick … : How do you know what fields will hold data for an SAP HANA model? This is going the quick and dirty approach, without requesting from the business, “what fields would you require?” in a 3 day workshop.

One way to check is via data distribution for all the columns and not just a single column. A single column, you can check in the “Data preview” – “Distinct Values” tab of SAP HANA Studio this will give you the distribution of records for that column ( I have seen errors appearing with large tables when doing it this way ).

To have an overview of all the fields of a table, simply execute “Open Definition” in the Catalog section and select “Runtime Information” tab. In the Runtime Tab you can select Columns and if you wait a little (it says “Fetching children in the bottom right corner) it will fill a list with all the columns and their amount of distinct records.

This can be helpful if you have to decide which fields to offer in the SAP HANA model. So if there are just NULL values or a single value, there wouldn’t much of a point including these fields (there are always exceptions like flags).

Another point is that you can use record distribution for performance analysis. If a table is highly granular and not compressed at all, it will likelt not perform well.

Tip: Overall, the less fields are used in the model, the better for execution time of the model.

CE1CL01.png

And you can also sort on this column and get the fields to include/exclude.

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Lars Breddemann

    Hey Denis,

    looks like SCN can’t really let go … the SAP badge is still up 😀

    And yep, there had been some (not so well documented) changes in the recent modeler revisions… stil catching up with them myself.

    cheers

    Lars

    (0) 

Leave a Reply