cancel
Showing results for 
Search instead for 
Did you mean: 

Projection VS Aggregation in SAP HANA

Former Member
0 Kudos

Hi All,

Could some one please help me the difference between projection and aggregation while creating a calculation view

a) What is difference between projection and aggregation used to create a calculation view

For me both behaves in the similar way. I used the efashion data to model a calculation view. my calculation view consist of one analytic view which provides me the data for Amount Sold, Article Id, Year and Week Id

If I remove the week id from the output of calculation view then then Amount sold gets aggregated automatically at year level while using a projection or aggregation between the output of calc view and analytic view. If i use week id then the aggregation does not happen at year level immaterial of the fact I use projection or aggregation

Thanks
HANA Enthusiast

Accepted Solutions (1)

Accepted Solutions (1)

hai_murali_here
Advisor
Advisor

Hi Karthik,

Both will result same output which is expected.

As I read it somewhere,

Aggregation node makes a bit more sense when working with raw tables. Until now we could only use a projection node on top of RAW tables, what is confusing is that under certain circumstances the Calculation view might give you the same result when using either a Projection or an Aggregation node. The intrinsic difference is when using an Aggregation node is that internally less data is transferred since it’s aggregated; which one can argue could improve performance.  With that said adding an Aggregation node on top of an OLAP view is questionable though since OLAP views by default aggregate. What’s also interesting is that the output node of a Calculation view is by default deployed as a aggregation node. In the image below you can see the differences in the amount of data that is transferred.  In SP4 or sooner there will be the notion of multidimensional reporting where the output node can be deployed as a projection node instead.

Rgds,Murali

Former Member
0 Kudos

Thank You, make sense to me now.

The piece of information which protrayed the difference between Projection and Aggregation you shared with me in this post was so useful.

I have many such questions and the documents that are available in SAP HELP Portal or other location are not enough. One such doubt I have is as below

Today while I was trying to understand Projection and Aggregation I found one thing, ADD to OUTPUT, and ADD to Aggregated Column in a Aggregation while in Projection there was only ADD TO OUTPUT. I need understand the definition of each of these features in SAP HANA. Is there a master reference guide available to understand all these.

I have the SQL Script reference guide though which I will skim through and try to check if the definition are available

rama_shankar3
Active Contributor
0 Kudos

Good points - thanks.

Former Member
0 Kudos

Hi Karthik

  As you mentioned while creating calculation with Aggregation view I have added the Amount column using add output option  then the result was as follows.

Product   Amount

1          10

2         10

3        10

4       10

When I used add as aggregated then the aggregation took place and the result is as below.

Product  Amount

1    20

2    10

3    10

4    10

when we add it simply as output no aggregation takes place, when we add it as aggregated column only then the aggregation took place.I did this on top of column table.

Thanks

Santosh

hai_murali_here
Advisor
Advisor
0 Kudos

Hi Karthik,

You can also follow blogs from

https://www.experiencesaphana.com/blogs/datamart

Rgds,Murali

Answers (3)

Answers (3)

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi,

The projection is used to apply filter inside a calculation view on a join of views or union of mutiple joins. There is no other way of applying filters inside a calculation view than applying a projection.

Whereas, aggregation is the default feature of calculation view. All the unions, joins or projections will finally merge into the aggregation box. Only the selected columns inside the aggregation will be visible in the calculation view output.

Regards,

Aditya Kashyap

former_member182277
Contributor
0 Kudos

Hello,

Some ponits from my side...

Projection: Projection is used when number of records generated by an analytic view can be reduced by grouping and by applying filter criteria. In simple projection is used to filter or restrict the data.

Aggregation: The column engine supports the following aggregation expressions.

MIN | MAX | COUNT | SUM | AVG ([DISTINCT] <column engine expression>).

Mainly used while creating the calculation measure.

The aggregation is done on the first level in your case it is week level. If you remove then automatically the aggregation will be done on the year level.

Hope it is useful.

Regards,Neha

Former Member
0 Kudos

Thanks for your help Neha. Because of such useful information that you have provided I am able to put together the jumbled pieces of the Puzzle