As of SAP HANA SPS10 Calculation Views support:
Calculation View described in this blog produces following data. As you can see Country Sales data is aggregated up into Region totals.
Below are instructions how to create the view.
Create Table Function that returns Region Parent Child Hierarchy
FUNCTION"WORKSHOP"."workshop.exercises::Region" ( )
RETURNSTABLE ( SUBREGIONNVARCHAR(3), REGIONNVARCHAR(3) )
LANGUAGESQLSCRIPT
SQLSECURITYINVOKERAS
BEGIN
RETURNSELECTDISTINCTCOUNTRYASSUBREGION, REGION
FROM"SAP_HANA_DEMO"."sap.hana.democontent.epm.data::MD.Addresses"
UNION
SELECTDISTINCTREGIONASSUBREGION, '' ASREGION
FROM"SAP_HANA_DEMO"."sap.hana.democontent.epm.data::MD.Addresses";
END;
Create Dimension Calculations View
Add Region Table Function to Projection Node
Add Geography Parent Child Hierarchy
Create Sales Calculation View with Star Join
Join Partner data with Address data
Join Sales data with Partner Address data
Join Sales fact data with Region Dimension Calculation view
Enable Hierarchies for SQL Access and confirm defaults.
Check hierarchy node column and hierarchy expression parameter for Geography Hierarchy
Preview Data and note that data is not aggregated up to region level
Group data by Hierarchy Node column and Preview Data. Note that data is aggregated up to Region level
Create Region Prompt for Geography Hierarchy
Preview Data selecting AMER Region
Preview Date selecting CA Region
Apply SQL Analytical Privileges to Sales Calculation View
Run Data Preview to make sure that data is secured by SQL Analytical Privilege
Create Analytical Privilege
Assign Sales Calculation View to Analytical Privilege
Enter SQL restrictions expression
Assign Region Analytical Privilege to the User
Preview data. Note that SQL Analytical Privilege limited data to AMER Region

































