Quantcast
Channel: SCN : Blog List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 676

Calculation View New SQL Features

$
0
0

As of SAP HANA SPS10 Calculation Views support:

SQL Hierarchies

SQL Hierarchical Prompts

SQL Analytical Privileges

 

 

SQL Hierarchies

 

Calculation View described in this blog produces following data. As you can see Country Sales data is aggregated up into Region totals.

Calculation View Cosumed in Excel Using MDX Connection.jpg

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;

Region Table Function Result.jpg

Create Dimension Calculations View

Region Dimension Calculation View 1 of 3.jpg

Add Region Table Function to Projection Node

Region Dimension Calculation View 2 of 3.jpg

Add Geography Parent Child Hierarchy

Region Dimension Calculation View 3 of 3.jpg

Create Sales Calculation View with Star Join

Sales Cube with Star Join 1 of 8.jpg

Join Partner data with Address data

Sales Cube with Star Join 2 of 8.jpg

Join Sales data with Partner Address data

Sales Cube with Star Join 3 of 8.jpg

Join Sales fact data with Region Dimension Calculation view

Sales Cube with Star Join 4 of 8.jpg

Enable Hierarchies for SQL Access and confirm defaults.

Sales Cube with Star Join 5 of 8.jpg

Check hierarchy node column and hierarchy expression parameter for Geography Hierarchy


Sales Cube with Star Join 6 of 8.jpg

Preview Data and note that data is not aggregated up to region level

Sales Cube with Star Join 7 of 8.jpg

Group data by Hierarchy Node column and Preview Data. Note that data is aggregated up to Region level

Sales Cube with Star Join 8 of 7.jpg



SQL Hierarchical Prompts


Create Region Prompt for Geography Hierarchy

Region Hierarchy Prompt 1 of 5.jpg

Preview Data selecting AMER Region

Region Hierarchy Prompt 2 of 5.jpg

Region Hierarchy Prompt 3 of 5.jpg

Preview Date selecting CA Region

Region Hierarchy Prompt 4 of 5.jpg

Region Hierarchy Prompt 5 of 5.jpg

 



SQL Analytical Privileges


Apply SQL Analytical Privileges to Sales Calculation View

SQL Analytical Privileges 1 of 7.jpg

Run Data Preview to make sure that data is secured by SQL Analytical Privilege

SQL Analytical Privileges 2 of 7.jpg

Create Analytical Privilege

SQL Analytical Privileges 3 of 7.jpg

Assign Sales Calculation View to Analytical Privilege

SQL Analytical Privileges 4 of 7.jpg

Enter SQL restrictions expression

SQL Analytical Privileges 5 of 7.jpg

Assign Region Analytical Privilege to the User

SQL Analytical Privileges 6 of 7.jpg

Preview data. Note that SQL Analytical Privilege limited data to AMER Region

SQL Analytical Privileges 7 of 7.jpg


Viewing all articles
Browse latest Browse all 676

Latest Images

Trending Articles



Latest Images