To concatenate two columns in Power BI, you can use the ampersand (&) operator in a DAX calculated column or the "Merge Columns" feature in Power Query. The ampersand method is fastest for simple additions, while Power Query is better for permanent data transformation during the loading process.

What You'll Need

  • Power BI Desktop installed on your computer.
  • A dataset already loaded into Power BI.
  • Two or more columns containing the text or numbers you wish to combine.

Step-by-Step

Depending on whether you want to change the data before it hits your report (Power Query) or create a new field for analysis (DAX), choose one of the two methods below. Note that menu labels may differ slightly depending on your version of Power BI Desktop.

Method 1: Using DAX (Calculated Column)

Use this method if you want to create a new column that updates dynamically based on your existing data without going back into the data transformation editor.

  1. Open your Power BI report and go to the Data view (the table icon on the left sidebar).
  2. In the Fields pane on the right, right-click the table containing the columns you want to merge.
  3. Select New column from the context menu.
  4. In the formula bar that appears at the top, enter a DAX formula using the ampersand (&) symbol. For example, to combine a "First Name" and "Last Name" column with a space between them, use: Full Name = 'TableName'[FirstName] & " " & 'TableName'[LastName]
  5. Press Enter. The new concatenated column will now appear in your table.

Method 2: Using Power Query (Merge Columns)

Use this method to clean your data during the "Transform Data" phase. This is generally more efficient for large datasets as it happens during the load process.

  1. From the Home tab in the main ribbon, click Transform Data to open the Power Query Editor.
  2. In the Power Query window, hold the Ctrl key and click the headers of the columns you want to concatenate. The order in which you select them is the order they will appear in the merged result.
  3. Go to the Add Column tab (to keep the original columns) or the Transform tab (to replace the original columns).
  4. Click Merge Columns.
  5. A dialog box will appear. In the Separator dropdown, choose your desired delimiter (e.g., Space, Comma, Semicolon, or Custom).
  6. In the New column name box, type a name for your combined column (e.g., "Full Address").
  7. Click OK.
  8. Click Close & Apply on the Home tab to save your changes and return to the report view.

Common Mistakes

  • Forgetting the Separator: When using DAX, if you simply write [Column1] & [Column2], the values will be smashed together (e.g., "JohnDoe" instead of "John Doe"). Always include a string in quotes, like " ", to create a space.
  • Data Type Mismatches: Attempting to concatenate a text column with a numeric or date column using DAX can sometimes cause errors. You must ensure all parts of the formula are treated as text.
  • Overusing Calculated Columns: Creating too many DAX calculated columns can increase the file size and slow down report performance. If the merge is a permanent part of your data cleaning, use Power Query instead.

Tips

  • Use FORMAT for Dates: If you are concatenating a date, use the FORMAT function in DAX to control how it looks. Example: .
  • Trim Your Data: Before concatenating, use the "Trim" feature in Power Query (Right-click column > Transform > Trim) to remove accidental leading or trailing spaces that could make your concatenated result look uneven.
  • Custom Delimiters: In Power Query, the "Custom" separator allows you to use characters like pipes (|) or dashes (—) which are helpful for creating unique IDs.

Troubleshooting

If the concatenation does not go to plan, try these steps in order:

  1. Check for Nulls: In DAX, if one of the columns contains a null value, the entire result of the concatenation may become null. Use the COALESCE function or a conditional IF statement to replace nulls with an empty string "".
  2. Verify Data Types: Ensure the columns are set to "Text" data type. If you are using DAX and have a number, wrap the column name in the FORMAT or STRING function to force it into text.
  3. Refresh the Preview: If you made changes in Power Query but don't see them in the report, ensure you clicked Close & Apply.
  4. Check Syntax: Ensure every opening quote " has a closing quote " and that every column reference is wrapped in square brackets [ ].

Frequently Asked Questions

Can I concatenate more than two columns?

Yes. You can add as many columns as needed by continuing to use the ampersand (&) in DAX or selecting multiple columns in Power Query before clicking Merge.

What is the difference between the CONCATENATE function and the & operator?

The CONCATENATE function in DAX only allows two arguments. The ampersand (&) operator is more flexible because it allows you to link an unlimited number of columns and text strings in a single formula.

How do I add a line break between concatenated columns?

In DAX, you can use the UNICHAR(10) function to insert a line break. Example: [Column1] & UNICHAR(10) & [Column2]. Note that you must enable "Word Wrap" in the visual settings to see the break.

Does merging columns in Power Query delete my original data?

Only if you select "Merge Columns" from the Transform tab. If you select it from the Add Column tab, Power BI creates a brand new column and keeps the original ones intact.

Why is my concatenated column showing as an error?

This is most commonly caused by trying to combine a non-text data type (like a Decimal or Integer) without converting it to text first, or by referencing a column name that has been renamed or deleted.