Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Count Distinct in CE_AGGREGATION?

$
0
0

Is there a way to use Count Distinct in CE_AGGREGATION?

 

I tried

var_out = CE_AGGREGATION(:var, [COUNT(DISTINCT "A") as "COUNT"], ["B", "C"]);

to get the number of distinct values of "A" for each combination of "B" and "C", but activation fails.

 

My workaround currently is to use two aggregations:

var_dummy = CE_AGGREGATION(:var, [COUNT("A") as "DUMMY"], ["A", "B", "C"]);

var_out = CE_AGGREGATION(:var_dummy, [COUNT("A") as "COUNT"], ["B", "C"]);

 

It works well but I am not sure if this is the most efficient way to do it (performance).

For example, would it be better to get :var from an analytical view (already aggregated to columns "A", "B", "C" --> only one CE_AGGREGATION needed) instead of using CE_COLUMN_TABLE and two aggregations?

 

Thanks for your Feedback,

Fabian


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>