In SQL Server Analysis Services, a Named Calculation is nothing but creating a new column and add it to a Table or View in Data Source View. Named Calculation is created based on the expression or some static value or combination of existing columns. The following are the essential features of the Named Calculations in SSAS
- Named Calculation allows you to add an extra column to the Tables or Views present in the SSAS Data Source View.
- All the Columns created using the Named Calculations belong to Data Source View only, and they are independent of underlying Data Source (Server).
- We can create a Calculated Column by combining one or more columns from the underlying data source View. For instance, finding the Full Name by combining First Name and Last Name
- We can create Named Calculation to hold any static value also
- We can create SSAS Named Calculation using SQL Expressions. For instance calculating the profits, Tax, Product waste, etc
- All the Named Calculations will calculate during the processing time. It may slow down the processing time.
Creating Named Calculations in SSAS
Click on the Data Source Views folder in Solution Explorer and then click on the created Data Source View. Please refer SSAS Data Source View article to understand, How to create Data Source View in SSAS.
Below screenshot will show you Data Source View
Right-click on DimEmployee Table in Data Source View will open the Context Menu with multiple options.
Select the New Named Calculation option from the context menu
When you click on the New named calculation option, an Edit Named Calculation window form (as shown below) will open to create the named Calculation in SSAS.
- The column name is the name you want to display to the end-user
- A description is to describe what this Named Calculation will do. It is optional but vital in real-time.
- An expression is a place used to write SQL expression or any Static Value.
In this example, we are creating Full Name by combining the FirstName and LastName Column in the DimEmployee table.
Expression: FirstName + ‘ ‘ + LastName
Click the ok button to finish creating Named Calculation in SSAS and check the Data Source View. You can see the Calculated Column (Created by Named Calculation) in Dim Employee Table. You can also observe a small tiff before the column name.