There is an option to create counter type measures with calc views that perform a count distinct of e.g materials, customer etc. However, there is no such option with an analytic view. I would hate to create a calc view just to use the counter feature of calc views. Is there an opportunity to create a calculated measure in an analytic view and write the SQL to do a count distinct in the expression editor?
The use of Calc Views are to reduce the data retrieval time by using the CE functions and hence improving the performance.Whenever you want to implement some complex business logic which cant be addressed with Analytic Views,you will go for Calc Views.There is a very good comparison table about all these things in SDN.So when you use Calc Views,it will improve the performance.
And using Count will not affect the performance as we retrieve only limited set of values here.Ideally Count should have been included in Analytic View itself rather than putting it into Calc Views.But that'show they designed it
BTW, one point. With the very basic nature of columnar database implemented in HANA, the distinct count of material / articles / documents is quite easy from database perspective. This is whole reason for using the columnar database as the processing will happen on the column itself which is stored in most efficient manner in the DB.
Alternatively you can check the distinct values in the columns using the distinct option on the table in HANA studio.
For reporting purpose it should not impact the performance if you select the distinct value from the analytic view.
I wanted to count # of VBAP records and first did that in the calculation view (created a counter on attribute VBELN with POSNR). This worked fine but response time of my view having 15 mil VBAP records went up to about 18 seconds.
Then I tried on the analytical view on VBAP: created a calculated measure (SUM) with static value 1 doing a calculate before aggregation. Same result but response time was ~3 seconds.
This test was on SP4.
Haven't tried again on SP5.
There are two options,
You may add the column from which you need to get the distinct count, as a Measure, with an aggregation type of 'COUNT'. This can be set in the Semantic Node.
In this option, please switch the flag "Allow Relational Optimization" to False, if you are getting inconsistent counts.
Add a numeric calculated column with a constant value of '1' and aggregate it with SUM in the Semantic node.
Let me know if that works for you.