How to Fix an Invalid CONCATENATEX Measure in Excel Power Pivot
Question details
The user needs to fix an invalid formula error and prevent unexpectedly long text results when using the CONCATENATEX measure to merge values in a table.

- Product
- Excel Power Pivot
- Device & OS
- not provided
- Scenario
- Creating or modifying a DAX measure in Power Pivot to concatenate string values from a specific table column.
- Observed behavior
- The CONCATENATEX measure returns an invalid formula error or produces excessively long results due to repeating duplicate values from the source table.
Verify that you are entering the formula as a DAX measure inside the Power Pivot data model window, as CONCATENATEX is a DAX function and will return an error if used as a standard worksheet formula.
Remove Duplicate Values Using the DISTINCT Function
Wrap your source column with the DISTINCT or VALUES function to filter out duplicate source values before the concatenation occurs.
When CONCATENATEX iterates over a table, it evaluates every row. If your column contains repeating codes, the final string will concatenate all those repeats, leading to massive text blocks or errors.
Using DISTINCT ensures that only unique values are fed into the CONCATENATEX function.
Navigate to the Power Pivot tab in the Excel ribbon and click 'Manage' to open the Data Model window.
Select the calculation area where your measure is located and click into the formula bar.
Modify the first argument of your CONCATENATEX formula to use DISTINCT. For example: =CONCATENATEX(DISTINCT(Table1[Code]), Table1[Code], ", ")
Press Enter to save the measure. Check your PivotTable to confirm that the duplicate strings have been removed from the final result.

Truncate the Result Using the LEFT Function
Use the LEFT function to shorten the output string if the concatenated text is valid but exceeds your display requirements.
Try WPS Office for Standard Data Analysis and Spreadsheets
While DAX and Power Pivot are features specific to Microsoft Excel, WPS Office Spreadsheet provides powerful, user-friendly data analysis tools, standard Pivot Tables, and advanced text functions completely free. Enjoy a lightweight application with excellent compatibility for your everyday spreadsheet needs.
- 1. Install WPS Office: Download and install WPS Office for free from the official website.
- 2. Open Your Excel File: Launch WPS Spreadsheet and click 'Open' to load your existing .xlsx workbook.
- 3. Apply Standard Formulas: Use native functions like TEXTJOIN to handle complex string concatenations natively in your spreadsheet.

Frequently Asked Questions
Why does my CONCATENATEX measure return an invalid formula error?
This error typically occurs if the formula is entered in a standard Excel worksheet cell instead of the Power Pivot data model, or if there is a DAX syntax error such as a missing comma, bracket, or parenthesis.
Can I use standard Excel text formulas instead of DAX for concatenation?
Yes. If you do not need the advanced relational data modeling of Power Pivot, you can use standard worksheet functions like TEXTJOIN or CONCAT to merge text with delimiters directly in standard spreadsheet cells.
What is the difference between VALUES and DISTINCT in DAX?
Both functions return a single-column table of unique values. However, VALUES includes the blank row created by invalid relationships in the data model (referential integrity violations), whereas DISTINCT strictly returns only the unique values physically present in the specific column.




