Dax Function: COMBINEVALUES
Category: Text Functions
The COMBINEVALUES function in Power BI is a DAX function used to concatenate two or more text strings into a single string, with a specified delimiter. It is especially useful when creating unique identifiers by merging multiple columns or fields.
Purpose
To merge text values with a specified delimiter, facilitating operations like creating composite keys or formatting values for display.
Calculations Performed
The function performs string concatenation by combining multiple text inputs with a defined separator. It simplifies constructing values that represent relationships between columns.
Practical Use Cases
- Creating composite keys by merging multiple columns in relational data models.
- Formatting strings for consistent display in reports.
- Preparing data for comparison or lookup operations.
COMBINEVALUES(delimiter, string1, string2 [, string3, …])
| Parameter | Type | Description |
|---|---|---|
| delimiter | Scalar | A string used to separate concatenated text values. Must be enclosed in double quotes (e.g., “, “). |
| string1 | Scalar | The first text value or column to be combined. |
| string2 | Scalar | The second text value or column to be combined. |
| string3… | Scalar | Additional text values or columns to be combined (optional). |
How Does COMBINEVALUES Dax Function Works
The function processes each input text string and combines them into a single output string, inserting the specified delimiter between values. It handles null or blank values gracefully by omitting them in the output, which prevents unnecessary separators.
Formula Logic Example:
COMBINEVALUES("-", "Power", "BI")
Result: "Power-BI"
What Does It Return?
The function returns a single text string that combines the input values, separated by the specified delimiter.
When Should We Use It?
- When constructing unique identifiers for rows based on multiple column values.
- To format concatenated data for visual representation in dashboards.
- When preparing data for use in comparisons, joins, or relationships.
Examples
Basic Usage
Concatenate two static text strings with a space as a delimiter.
COMBINEVALUES(" ", "Power", "BI")
Result: "Power BI"
Column Usage:
Concatenate two columns with a hyphen (-) as a delimiter.
COMBINEVALUES("-", 'Table'[FirstName], 'Table'[LastName])
Result (Row Example): "John-Doe"
Advanced Usage
Combine three fields with a pipe (|) separator for creating composite keys.
COMBINEVALUES("|", 'Sales'[Region], 'Sales'[Category], 'Sales'[Product])
Result (Row Example): "North|Furniture|Chair"
Tips and Tricks
- Avoid Blank Delimiters: Ensure the delimiter is meaningful to avoid issues in separating values later.
- Handle Blanks: COMBINEVALUES automatically ignores blank or null values; however, verify your data for consistency.
- Use in Relationships: This function is particularly useful for creating calculated columns to act as composite keys in relationships.
Performance Impact of COMBINEVALUES DAX Function:
- Efficient for concatenating scalar values.
- For large datasets, consider using calculated columns to avoid recalculating dynamically in visuals.
Related Functions You Might Need
- CONCATENATE: Joins two text strings without specifying a delimiter.
- CONCATENATEX: Concatenates values in a column, using a delimiter.
- TEXT: Formats numbers or dates as text.
Want to Learn More?
For more information, check out the official Microsoft documentation for COMBINEVALUES You can also experiment with this function in your Power BI reports to explore its capabilities.
Unlock the full capabilities of Power BI and elevate your data insights with our specialized consulting services. Whether you need guidance on advanced DAX functions like those highlighted here, support in designing interactive dashboards, or expertise in optimizing data models for enhanced performance, our experienced Power BI consultants are equipped to deliver customized solutions for your business. Explore our Power BI Consulting Services page to discover how we can help your organization make smarter, data-driven decisions.
To concatenate multiple text strings with a specified delimiter, often used for creating composite keys.
Blank or null values are ignored, and no delimiter is inserted in their place.
Yes, numeric columns will be converted to text during the concatenation process.
CONCATENATE combines two text values without a delimiter, while COMBINEVALUES allows you to specify a delimiter.
Yes, but using calculated columns for static concatenation improves performance.