Skip to Content

Create a Calculation View with Differential Privacy in SAP Web IDE

Requires Customer/Partner License
Use differential privacy to anonymize confidential data
You will learn
  • How to create Calculation View of type Cube using SAP Web IDE
  • How to configure differential privacy to add noise to a column
jung-thomasThomas JungNovember 21, 2022
Created by
May 23, 2019


  • This tutorial is designed for SAP HANA service for SAP Business Technology Platform. Consider newer tutorials designed for SAP HANA Cloud.
  • You have completed the previous tutorials to load data into the table TGT_SALARIES

>**This tutorial cannot be completed with a trial account.**

  • Step 1

    Create a new folder called models under db/src. Create a new Calculation View and call it SALARIES_ANONYMIZED

    New calculation view

    Click on the anonymization node and then click on the white canvas to drop it.

    New calculation view

    Use the

    plus sign
    on the node to add a table as a data source. Choose TGT_SALARIES

    New calculation view
  • Step 2

    Double click on the Anonymize_1 node. This will open the mapping. Double click on TGT_SALARIES to add all of the columns to the output

    New calculation view

    Click Details and switch k-anonymity to Differential Privacy

    Configure privacy

    Configure the following parameters for anonymity

    • Sequence Column: ID
    • Epsilon: 0.1
    • Sensitivity: 15000
    • Noised Column: SALARY

    For example:

    Configure privacy

    For more information about these parameters check the SAP HANA Security Guide

  • Step 3

    Connect the Anonymize_1 node to the Aggregation node.

    Configure privacy

    Double-click on the name of the node to move all the fields into the output columns.

    Configure privacy

    Go into the Semantics node and switch START_YEAR to attribute

    Configure privacy
  • Step 4

    Save and Build the calculation view

    Configure privacy

    Right-click on it and choose Data Preview

    Configure privacy

    Click Raw Data and you will see the anonymized data:

    Configure privacy

    See the negative salaries? The added noise guarantees privacy while keeping sum and average results similar to the original dataset.

    Use the Analysis tab and drag the GENDER and REGION fields to the label axis and ID to the Value axis.
    Change the aggregation for SALARY to COUNT to answer the question below.

    Configure privacy
  • Step 5

    If you have a tenant in SAP Analytics Cloud or a reporting tool such as Analysis for Office, you can configure the SAP HANA Analytics Adapter. The adapter is a Java application that exposes Calculation Views for consumption through Information Access (or InA).

    Follow the steps in the following blog post if you want to set up the HANA Analytics Adapter:

Back to top