In this article, we’ll take a closer look at how to use the COMBINEVALUES function in Power BI. We’ll cover everything from the syntax of the function to some practical examples of how to use it in your own reports and dashboards.
What is the COMBINEVALUES function?
The COMBINEVALUES function is a DAX function that allows you to combine two or more text values into a single text value. The syntax of the function is as follows:
COMBINEVALUES(separator, value1, value2, …)
The separator parameter is the character or string that you want to use to separate the values. For example, if you wanted to combine the values "John" and "Doe" with a space between them, you would use the following formula:
COMBINEVALUES(” “, “John”, “Doe”)
The result of this formula would be the text value "John Doe".
Using the COMBINEVALUES function in Power BI
Now that we know what the COMBINEVALUES function is and how it works, let's take a look at some practical examples of how to use it in Power BI.
Example 1: Combining first and last names
One common use case for the COMBINEVALUES function is to combine first and last names into a single text value. To do this, you would use the following formula:
COMBINEVALUES(” “, [First Name], [Last Name])
In this example, we're using a space as the separator between the first and last names. If you wanted to use a different separator, such as a comma, you would simply replace the space with a comma in the formula.
Example 2: Creating a unique identifier for an item
Another use case for the COMBINEVALUES function is to create a unique identifier for an item based on multiple columns of data. For example, let's say you have a table of customer data that includes columns for first name, last name, and email address. You could create a unique identifier for each customer by combining these three columns into a single text value, like this:
COMBINEVALUES(“_”, [First Name], [Last Name], [Email])
In this example, we're using an underscore as the separator between the first name, last name, and email address. The result of this formula would be a unique identifier for each customer that includes all three pieces of information.
The COMBINEVALUES function is a powerful tool that allows you to combine two or more text values into a single text value. This function is especially useful when you're dealing with data that is split across multiple columns or when you need to create a unique identifier for an item. By using the examples and techniques outlined in this article, you can start taking advantage of the COMBINEVALUES function in Power BI today.
Power BI DAX Training Courses by G Com Solutions (0800 998 9248)
Power BI DAX Intensive Training Course£1,050.00 – £26,550.00
Power BI DAX Introduction£395.00 – £9,750.00
Power BI DAX Intermediate£395.00 – £9,750.00
Power BI DAX Advanced£395.00 – £9,750.00