Calculated Table And Column In Tabular Editor 3 (2024)

This tutorial will discuss how to create a calculated table and column in the Tabular Editor. You’ll learn how to pull out and summarize tables and columns using DAX functions. You’ll also understand why Tabular Editor is better at creating calculated tables and columns than Power BI Desktop.

Table of Contents

Creating A Calculated Column

To create a calculated column, right-click on a table and select Create. Then, choose Calculated Column. For this example, a calculated column is created in the Sales table. After that, name the column Product Name.

Calculated Table And Column In Tabular Editor 3 (2)

If you go to the ProductsData table, you can see a Product Name column.

Calculated Table And Column In Tabular Editor 3 (3)

You need to copy that column to the Sales table. Open the Product Name column in the Sales table and input the syntax. Use the RELATED function to access the relationship of the Sales table and ProductsData table and retrieve values. Once done, press CTRL + S so that changes can be saved.

Calculated Table And Column In Tabular Editor 3 (4)

Loading The Calculated Column

If you go back to the Power BI Desktop, you need to refresh the model so that the calculated column will be loaded.

Calculated Table And Column In Tabular Editor 3 (5)

Next, if you go to the Sales table, you can see the Product Name column.

Calculated Table And Column In Tabular Editor 3 (6)

Now, create another calculated column in a dimension table and name it as the ProductsData table. Input the following syntax and name the column # Rows Sales.

Calculated Table And Column In Tabular Editor 3 (7)

The Sales Channel column in the Sales table is used to determine the number of matching rows.

Calculated Table And Column In Tabular Editor 3 (8)

If you preview the Sales table, you can see that the Sales Channel column contains values like Online, In-Store, Distributor, and Wholesale.

Calculated Table And Column In Tabular Editor 3 (10)

After that, press CTRL + S to save the changes in the tabular model inside Power BI and click Refresh Now to load the calculated column. If you open the ProductsData table, you can then see the # Rows Sales column which shows how many rows are there in each product name in the Sales table.

Calculated Table And Column In Tabular Editor 3 (11)

Creating A Calculated Table

Aside from calculated columns, you can also create calculated tables in Tabular Editor. To create a calculated table, right-click on the Tables folder. Click Create and then select Calculated Table. Name the table Products And Region Sales.

Calculated Table And Column In Tabular Editor 3 (12)

For this example, the calculated table will be a summary of some fields from the ProductsData, Sales, and SalesTeams tables. From the ProductsData table, Product Name will be used. Total Sales and Sales Channel will be used from the Sales table. And lastly, Region will be used from the SalesTeams table.

Calculated Table And Column In Tabular Editor 3 (13)

Next, double-click the calculated table to open the Expression Editor and to start creating codes. First, use the SUMMARIZE function to summarize the Fact table by the other tables. Create another variable that will add the Sales amount to each row of the tables using the ADDCOLUMNS function. Then, input the RETURN function with the ProductRegion variable.

Calculated Table And Column In Tabular Editor 3 (14)

Once done, press CTRL + S to save the changes done in the model. Go back to the Power BI Desktop and refresh the table. After that, you can then see the Products and Region Sales table with two columns, namely, Product Name and Region.

Calculated Table And Column In Tabular Editor 3 (15)

Go back to the Tabular Editor and change the code. Instead of returning ProductRegion, return ProductRegionSales. After that, press CTRL + S and refresh the model in Power BI.

Calculated Table And Column In Tabular Editor 3 (16)

If you view the Products And Region Sales table, you can then see the @Total Sales column.

Calculated Table And Column In Tabular Editor 3 (17)

Adding Additional Fields In The Calculated Table

Go back to the Tabular Editor and add the Sales Channel from the Sales table to the summary of the first variable. Do this as seen below.

Calculated Table And Column In Tabular Editor 3 (18)

Once done, press CTRL + S and refresh the model in Power BI. You can then see the Sales Channel column in the calculated table.

Calculated Table And Column In Tabular Editor 3 (19)

***** Related Links *****
See Changing Results Using Calculated Columns In Power BI

Comparing Calculated Columns And Measures In Power BI
Tabular Editor 3: Beginner To Advanced – The Tenth New Course On Enterprise DNA’s Educational Platform In 2021

Conclusion

Using Tabular Editor to create calculated columns and tables is faster and more convenient than using the Power BI Desktop. It’s because you don’t need to directly refresh the metadata every time you perform an action. The only time the Tabular Editor is refreshed is when you press CTRL + S.

Enterprise DNA Experts

Calculated Table And Column In Tabular Editor 3 (20)

Sam McKay, CFA

Sam is Enterprise DNA's CEO & Founder. He helps individuals and organizations develop data driven cultures and create enterprise value by delivering business intelligence training and education.

See Full Bio

Calculated Table And Column In Tabular Editor 3 (2024)

FAQs

Calculated Table And Column In Tabular Editor 3? ›

To create a calculated column, right-click on a table and select Create. Then, choose Calculated Column. For this example, a calculated column is created in the Sales table. After that, name the column Product Name.

How do you create a calculated table in Tabular Editor 2? ›

To create a calculated table just right click on the Table and choose Calculated Table. After you click Calculated Table or press ALT + 6 it will open a new window where you can write the DAX code for the calculated table. Change the name of the column and press CTRL + S to save the model.

How do you create a measure table in tabular Editor? ›

To create a measure, right-click on a table and select Create. Then, choose Measure. What is this? In this example, the Sales table is used to create a measure.

How do I add a calculated table? ›

How to create a calculated table
  1. First, verify the tabular model has a compatibility level of 1200 or higher. ...
  2. Switch to the Data View. ...
  3. Select Table > New calculated table.
  4. Type or paste a DAX expression (see below for some ideas).
  5. Name the table.
  6. Create relationships to other tables in the model.
Dec 9, 2022

How do you create a calculated column in Tabular Editor 3? ›

Creating A Calculated Column

To create a calculated column, right-click on a table and select Create. Then, choose Calculated Column. For this example, a calculated column is created in the Sales table. After that, name the column Product Name.

How do you add a column to a table in tabular model? ›

Add a blank column
  1. In the model designer, in Data View, select the table to which you want to add a blank column, scroll to the right-most column, or click the Column menu, and then click Add Column. ...
  2. Click on the top cell, then type a name, and then press ENTER.
Dec 9, 2022

How to create a table in SSAS tabular? ›

In this article
  1. In Tabular Model Explorer, expand Data Sources, right-click a data source, and then click Import new tables.
  2. In Navigator, select the table you want to add to your model. ...
  3. If necessary, use Transform Data to select only certain columns or apply filters to the data to be imported.
Dec 9, 2022

How do you create a calculated column in a table in SQL? ›

Select the table upon which you would like to add the Calculation column. While on the correct table, click Create New Column at the top right of the screen. From the Select a definition dropdown, select Same Table . Select Calculation as the column definition equation .

How do you make a tabular column? ›

Create and format tables
  1. Select a cell within your data.
  2. Select Home > Format as Table.
  3. Choose a style for your table.
  4. In the Create Table dialog box, set your cell range.
  5. Mark if your table has headers.
  6. Select OK.

How do you Create calculation groups in tabular editor? ›

In Tabular Model Explorer, right-click Calculation Groups, and then click New Calculation Group. By default, a new calculation group has a single column and a single calculation item. Use Properties to change the name and enter a description for the calculation group, column, and default calculation item.

How do you Create a measure in SSAS Tabular Model? ›

Tabular model. To create the same measure in a Tabular SSAS database, we need to select the table tab to contain the measure. Usually, this is the same table as the columns needed for the calculation but does not have to be. In this example, that is the Internet Sales tab.

How do you process a table in tabular editor? ›

In SQL Server Management Studio, in the tabular model database which contains the table you want to process, expand the Tables node, then right-click on the table you want to process, and then click Process Table.

How do you add a calculated column? ›

Create a calculated column
  1. Create a table. ...
  2. Insert a new column into the table. ...
  3. Type the formula that you want to use, and press Enter. ...
  4. When you press Enter, the formula is automatically filled into all cells of the column — above as well as below the cell where you entered the formula.

How do you add a calculated column in a data table? ›

How to Insert a Calculated Column
  1. Select Insert > Calculated Column....
  2. If you have more than one data table in the document, select the Data table to work on.
  3. Specify a suitable expression by either typing it directly into the Expression text field, or by selecting columns, properties and functions from the list.

How do you add calculated column lists? ›

Add a calculated column to a list or library
  1. Open the list or library.
  2. Near the top right of the browser window, select Settings. ...
  3. On the Settings page, under Columns, select create Column.
  4. In the Name and Type section, enter the name that you want in the Column name box.

How do I create a computed column in SAS? ›

Creating Calculated Columns
  1. Open a table. Then click. ...
  2. Select Calculated column in the transforms list. Then, click Add Transform.
  3. In the Calculated Column window, enter a DATA step expression in the Expression field. Here are a few considerations: ...
  4. Indicate how you want the calculated column to appear. ...
  5. Click Run.

Top Articles
Latest Posts
Article information

Author: Sen. Emmett Berge

Last Updated:

Views: 6130

Rating: 5 / 5 (60 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Sen. Emmett Berge

Birthday: 1993-06-17

Address: 787 Elvis Divide, Port Brice, OH 24507-6802

Phone: +9779049645255

Job: Senior Healthcare Specialist

Hobby: Cycling, Model building, Kitesurfing, Origami, Lapidary, Dance, Basketball

Introduction: My name is Sen. Emmett Berge, I am a funny, vast, charming, courageous, enthusiastic, jolly, famous person who loves writing and wants to share my knowledge and understanding with you.