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

How to calculate Average Price

$
0
0

Hi,

having worked a lot with other analytic engines (mainly Microsoft Analysis Services) I am currently digging into SAP HANA and its Analytical Views. But I am already stuck at what I consider the most basic requirement - calculating an average like this:

SalesQuantityAvg Price
Product A100010100=1000 / 10
Product B221=5 / 1
All Products10021283,5=1002 / 12
=1000 + 2=10 + 2

 

So "Avg Price" is defined as "Sales"/"Quantity":

AvgPrice.jpg

 

How can I make the "Avg Price" for 'All Products' show the correct value as in the example above?

at the moment it simply sums up 100 + 1 which is of course wrong as averages cannot be summed up ...

 

I have found some "solutions" (I would not call it like that) here on the SAP HANA Developer Center which all rely on creating a second table with the same granularity as the main table but without e.g. products and use this to create averages, ratios, etc.

see for example here: SAP HANA: Using "Dynamic Join" in Calculation View (Graphical)

 

But this does of course not work anymore if i put e.g. Months or any other attribute (except Products)  on rows which renders the whole Analytical View useless for Ad-Hoc reporting

 

maybe I just missed something (hope so)

any feedback is highly appreciated!

 

thanks,

gerhard


Viewing all articles
Browse latest Browse all 6412

Trending Articles



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