#### Create a Cube Calculation View (XS Advanced)

0 %
Create a Cube Calculation View (XS Advanced)
Details
// Explore More Tutorials

# Create a Cube Calculation View (XS Advanced)

09/06/2018

Intermediate
15 min.
Create a graphical calculation view with a cube data type.

#### You will learn

• How to create a calculation view with a Cube data type
• Use a star join to combine data from a dimension calculation view and a table
• Perform currency conversion

Step 1: Create a new Calculation view of type Cube

Create a new calculation view in your models folder.

Call it `PURCHASE_ORDERS`, choose `CUBE` as a data category and mark the flag for `With Star Join`

Step 2: Join header and items

Drag and drop a join node and add click on the + sign to add the data sources

Type `PO` and choose both `PO.Header` and `PO.Item` and click Finish.

Create a inner join using `PURCHASEORDERID` and set the cardinality as `1..n`

In the mapping tab, add the following columns to the output: `PURCHASEORDERID`, `HISTORY.CHANGEDAT`, `PRODUCT.PRODUCTID`, `CURRENCY` and `GROSSAMOUNT`.

Finally, rename the node to `PO`.

Step 3: Join Purchase Orders with products dimension

Connect the output of the join to the `Star Join`. Use the + sign to search and select `PRODUCTS`.

Join the `PRODUCTID` and `PRODUCT.PRODUCTID` as an inner join.

Step 4: Create an input parameter

In the Input Parameters tab, create an input parameter named `IP_O_TARGET_CURRENCY`.

Configure it as `NVARCHAR`, length 3 with a Semantic type of Currency.
Flag it as mandatory and set a default value of `USD`.

Step 5: Configure semantics for currency conversion

Go into the mapping tab and double click on the `PO` parent node to add all of the fields to the output. Add the `GROSSAMOUNT` a second time.

Change the name of the duplicate column to `OriginalGrossAmount`.

Click the semantics node and assign semantics for `GROSSAMOUNT`.

Choose Amount with Currency Code and configure as follows:

• Display Currency: column, choose `GROSSAMOUNT_CURRENCY`
• Check the `Conversion` and `Decimal shift` boxes

Click on the `definition` tab and use the following configuration

Save the view.

Step 6: Build and preview

Build the `db` module and return to the database explorer

Navigate to the column view, right-click on it and select Open Data.

## Prerequisites

Navigate tutorial steps