To start, view the ‘Store’ table in data view.
You’ll see all the columns that belong to that table.
As expected, the table contains information about stores like what city they’re located, postal code, store name, selling area size, and others.
Now, let’s say that you would like to create a new column that contains the city where the store is located plus the postal code.
In short, you would like to combine the values within the ‘City’ column and the ‘PostalCode’ column.
To add a new column, right-click on the ‘Store’ field and select ‘New column’:
That will create a new column on the table.
For convenience, give your new column a new name that’s related to the values you would like to put.
Let’s name the column “Location” by changing on the formula bar:
The next part is telling Power BI to put the values from the ‘City’ and ‘PostalCode’ columns to the new ‘Location’ column.
Again, let’s assume that what you would like to happen is put a comma (,) between the values like in “Weirton, WV, 26032”.
The first step is to refer to the ‘City’ column. Write an opening bracket “[“ on the formula bar.
You would see a suggestion of all the columns that exist on the table. To make it easier, type in “City” and choose the one with “[City]” by pressing the tab or enter key on your keyboard.
It should now look like this:
To join two text strings together, you would need to use the ‘CONCATENATE’ function.
However, instead of using the DAX code, we’ll be using the ampersand (&) operator.
Since what we would like to happen is [City] + , + [PostalCode], the syntax should be:
Location = [City] & ", " & [PostalCode]
After pressing enter, Power BI will populate your new column with the desired values:
If the values appeared on your end, congratulations! You just made your first calculated column in Power BI. 🎉