Tuesday 3 October 2017

SAP HANA: Counters


If you want to count the number of distinct values for one or more attribute columns, you create counters, which are a special type of columns that display the distinct count of attribute columns.

Context

You can create counters for multiple attribute columns at a time. For example, if you create a counter for two columns, then the counter displays the count of distinct combinations of both the columns.
Note
You can create counters for attribute columns in the default star join node or in the default aggregation view node only.

Example:

Consider a business scenario where you want to count the distinct products in each Product Category.

Solution:

1. Open the required information view in the view editor.
2. Choose the Star Join or the Aggregation node.
3. In the Output pane, choose the New icon drop-down.
4. Choose the New Counter menu option.
5. In the Counter dialog, provide counter name and description.
6. If you want to hide the counter for data preview, then select the Hidden checkbox.
7. In the Counters pane, choose Add.
8. In the dropdown list, choose an attribute. And it will be shown as below

9. Click Ok.
Note
            If queries on a calculation view contain filters on columns that you have not chosen to project, and if you have defined a counter on a calculation view, which you want to use in other calculation views, then you need to set the Transparent flag property to True for such columns in all nodes that contains this column and for the node in the calculation view that contains the counter. This helps counters to function at their expected behavior for the above scenario.
10. And validate and activate the view.
11. Result: In Analysis drag and drop:
Label Axis: EnglishProductCategoryName
Value Axis: Total_Product (i.e., the counter which we created)


3 comments:


  1. Worthful SAP HANA tutorial. Appreciate a lot for taking up the pain to write such a quality content on SAP HANA tutorial. Just now I watched this similar SAP HANA tutorial and I think this will enhance the knowledge of other visitors for sure. Thanks anyway.:-https://www.youtube.com/watch?v=-EkGfy7kBWQ

    ReplyDelete
  2. Heartful thanks for Author.

    ReplyDelete