Power BI CONCATENATE Function (DAX): How and When to Use it Simplified 101

|

Power BI Concatenate Function_FI

Visual Analytics is the union of Data Analytics and Visualisations. This problem-solving approach is concerned with effectively facilitating high-level, complex activities such as reasoning and data-driven decision-making by integrating interactive visual representations with underlying analytical processes. Power BI is a Business Intelligence (BI) tool and a Visual Analytics engine offered by Microsoft that provides you with real-time high-level analytics, extensive modeling, and custom development. It has led the charge in making business analysis more efficient through services that are intuitive, interactive, and easy to use.

In this article, you will gain information about Power BI CONCATENATE Function. You will also gain a holistic understanding of Power BI, its key features, DAX functions in Power BI, and the usage of Power BI CONCATENATE Function. Read along to find out in-depth information about Power BI CONCATENATE Function.

Table of Contents

What is Power BI?

Power BI Concatenate Function: Power BI Logo
Image Source

Power BI is a part of Microsoft Power Platform and a proprietary Data Visualization and Business Intelligence platform. It is one of the widely used tools among organizations to analyze business data and generate reports. Power BI uses a collection of various in-built software services, apps, and connectors to deeply integrate with data to provide immersive visuals, interactive reports, and generate insights.

Power BI helps users to aggregate, analyze, visualize and share data. It is a SaaS (Software as a Service) based platform and is also available for Desktop, mobile, and on-premise servers. Power BI supports connection with many data source connectors to load data into the Dashboard directly from the data source and visualize data stored in Databases or Data Warehouses. Users use the Power BI Chart, graphs, KPIs, reports to analyze the data and get interactive insights.

Key Features of Power BI

Some of the main features of Power BI are listed below.

  • Hybrid Development: Power BI offers integrations with many connectors that allow users to connect to various data sources.
  • Modeling View: Power BI allows users to divide and slice complex data models into a simpler form, separate diagrams, multi-select objects. 
  • AI Support: Power BI supports Artificial Intelligence in Data Analytics that users can leverage to prepare data, build Machine Learning models and quickly identify insights from structures as was unstructured data. 
  • Quick Insights: Power BI makes it easier for users to create subsets of data and automatically Data Analytics to that information.
  • Report Sharing: Users can easily share their reports with other users of the organization without worrying about data security. 

To know more about Power BI, click here.

Simplify the Power BI Visualization Process with Hevo’s No-code Data Pipeline

A fully managed No-code Data Pipeline platform like Hevo Data helps you integrate and load data from 100+ Data Sources (including 40+ Free Sources) such as Power BI to a Data Warehouse/Destination of your choice in real-time in an effortless manner. Hevo with its minimal learning curve can be set up in just a few minutes allowing the users to load data without having to compromise performance. In addition to the 100+ data sources, Hevo also allows integrating data from non-native sources using Hevo’s in-built Webhooks Connector.

Get Started with Hevo for Free

Its strong integration with umpteenth sources allows users to bring in data of different kinds in a smooth fashion without having to code a single line. 

Check out some of the cool features of Hevo:

  • Completely Automated: The Hevo platform can be set up in just a few minutes and requires minimal maintenance.
  • Connectors: Hevo supports 100+ Integrations to SaaS platforms, Files, Databases, BI tools such as Tableau, and Native REST API & Webhooks Connectors. It supports various destinations including Google BigQuery, Amazon Redshift, Snowflake Data Warehouses; Amazon S3 Data Lakes; Databricks (Connector Live Soon!); and MySQL, SQL Server, TokuDB, DynamoDB, PostgreSQL Databases to name a few.  
  • Real-Time Data Transfer: Hevo provides real-time data migration, so you can have analysis-ready data always.
  • 100% Complete & Accurate Data Transfer: Hevo’s robust infrastructure ensures reliable data transfer with zero data loss.
  • Scalable Infrastructure: Hevo has in-built integrations for 100+ sources (Including 40+ Free Sources) such as Tableau that can help you scale your data infrastructure as required.
  • 24/7 Live Support: The Hevo team is available round the clock to extend exceptional support to you through chat, email, and support calls.
  • Schema Management: Hevo takes away the tedious task of schema management & automatically detects the schema of incoming data and maps it to the destination schema.
  • Live Monitoring: Hevo allows you to monitor the data flow so you can check where your data is at a particular point in time.
Sign up here for a 14-Day Free Trial!

What are DAX Functions in Power BI?

Data Analysis Expressions (DAX) are a set of functions and operators that can be used to build formulas and expressions in Microsoft SQL Server Analysis Services, Excel Power Pivot, and Power BI Desktop. A DAX function is a predefined formula that performs calculations on the values passed to it as arguments.

The arguments in a function need to be in a particular order and can be a column reference, numbers, text, constants, another formula or function, or a logical value such as TRUE or FALSE. Every function performs a particular operation on the values enclosed in an argument. You can use more than one argument in a DAX formula.

Some of the Power BI DAX functions are:

  • Time Intelligence Functions: These functions assist you in creating computations that make use of the built-in calendar and date knowledge. You can make meaningful sales, inventory, and other comparisons over similar time periods by combining time and date ranges with aggregations or other calculations.
  • Date & Time Functions: These are used to do calculations on date and time values.
  • Logical Functions: These are used to logically assess an expression or argument and return TRUE or FALSE depending on whether or not the condition is fulfilled.
  • Mathematical & Trigonometric Functions: These are used to conduct a variety of mathematical operations on the values specified.

Key Points about DAX Functions

Here are some unique facts about DAX functions that you must know in order to understand them better:

  • Any DAX function will always refer to an entire column/field or table. It will never make any reference to personal values. If you want to use the functions on different values in a column, you must use filters in a DAX formula.
  • The flexibility of DAX functions allows you to create a formula that is applied row by row. Calculations or formulas are applied in accordance with the context of the values in each row.
  • In some cases, DAX functions return an entire table that can be used in other DAX formulas that require a complete set of values. However, you are unable to view the contents of this table.
  • Time intelligence functions are a subset of DAX functions. These functions are used to compute time/date ranges and periods.

What is Power BI CONCATENATE Function?

The Power BI CONCATENATE function is a DAX function that combines two text strings into one. Text, integers, or Boolean values displayed as text, or a mix of those elements can be connected. If the column has appropriate values, you may also utilize a column reference.

1) Syntax

The basic syntax of the Power BI CONCATENATE function is as follows:

CONCATENATE(<text1>, <text2>)  

2) Parameters

text1, text2: These are the text strings that will be combined to form a single text string. Strings can include both text and numbers. Column references can also be used.

3) Return value

The Power BI CONCATENATE function returns the concatenated string.

4) Remarks

  • The Power BI CONCATENATE function in DAX only takes two parameters, but the Excel CONCATENATE function takes up to 255.
  • If you need to concatenate several columns, you may use the nested Power BI CONCATENATE function to produce a sequence of computations, or you can use the concatenation operator (&) to unite all of them in a simpler statement.
  • If you need to incorporate text strings directly (rather than utilizing column references) in the join, make sure to surround each string in a double quote mark.
  • When used in calculated columns or row-level security (RLS) rules, this function is not supported in DirectQuery mode.

Use Cases of Power BI CONCATENATE Function

Several use cases of the Power BI CONCATENATE function are as follows:

1) Concatenation of Literals

By concatenating literals means that you can combine two string values that are given as arguments to the Power BI CONCATENATE function which will result in a single new string value.

The sample formula creates a new string value by combining two string values that you provide as arguments.

= CONCATENATE("Hello ", "World") 

Output:

Hello World

In the above example, a space is deliberately left after “Hello” to ensure that there is a space between the 2 arguments while concatenating them. Otherwise, if no space had been left then the output would have been “HelloWorld”.

2) Concatenation of Strings in Columns

By concatenating strings in columns means that you can concatenate strings where column names are given as arguments and the concatenation is applied on a row-by-row basis for the columns given as arguments.

The below formula returns the customer’s full name in the Phone Book database. The concatenation applied on the “LastName” and “FirstName” columns. For the first Power BI CONCATENATE function, it can be seen that the nested CONCATENATE function is given as the second argument. This is one method for concatenating multiple strings when you have more than two values to use as arguments.

= CONCATENATE(Customer[LastName], CONCATENATE(", ", Customer[FirstName]))

The above code of Power BI CONCATENATE function will help to concatenate the value present in two columns, i.e, LastName and FirstName into the resulting column along with a “,” and ” ” (space) in between.

The pattern of output will be:

 "LastName, FirstName"

In the below image, the “First Name” and “Last Name” columns are concatenated.

Power BI CONCATENATE function: Sample table showing First and Last names

The code for using Power BI CONCATENATE function.

Full Names =
CONCATENATE (
    Sample_HR_Dataset_v2[First Name],
    CONCATENATE ( " ", Sample_HR_Dataset_v2[Last Name] )
)    


The output column showcases the usage of the Power BI CONCATENATE function.

Power BI CONCATENATE function: Sample table showing Full Names created  using CONCATENATE

If you also want to include the values of the “Middle Initial” column in the “Full Names” column, then for this additional argument, you can use the Nested POWER BI CONCATENATE function as shown below.

Full Names v2 =
CONCATENATE (
    CONCATENATE (
        Sample_HR_Dataset_v2[First Name],
        CONCATENATE ( " ", Sample_HR_Dataset_v2[Middle Initial] )
    ),
    CONCATENATE ( " ", Sample_HR_Dataset_v2[Last Name] )
)    

The resulting output column “Full Names v2” is as follows:

Power BI CONCATENATE function: Sample table showing Full Names v2 with Middle initials created  using CONCATENATE

3) Conditional Concatenation of Strings in Columns

By Conditional Concatenation of Strings in Columns means that you can create a concatenated column based on a condition given to the Power BI CONCATENATE function.

The following formula adds a new calculated column to the Customer table that contains the full customer name as a combination of first name, middle initial, and last name. However, it also checks to see if the customer has a middle name. If there is no middle name, the last name follows immediately after the first. If there is a middle name, just the first letter is used, and the first letter is followed by a period.

= CONCATENATE( [FirstName]&" ", CONCATENATE( IF( LEN([MiddleName])>1, LEFT([MiddleName],1)&" ", ""), [LastName]))

In the above formula, nested Power BI CONCATENATE function to accommodate the combination of more than 2 strings. IF function is used to conditionally concatenate the strings. And “&” operator is used to add spaces as separators.

Suppose you want to create a field for customers with their Full Name, which is a combination of “First Name“, “Middle Initial” and “Last Name” columns. However, in the absence of a “Middle Initial,” you must add a conditional concatenation to take the initial letters of the “First Name.”

Power BI CONCATENATE function: Sample table showing Middle initial highlighted

The code for creating the column by applying conditional concatenation of strings is as follows:

Cond_Full Names =
CONCATENATE (
    Sample_HR_Dataset_v2[First Name] & " ",
    CONCATENATE (
        IF (
            LEN ( Sample_HR_Dataset_v2[Middle Initial] ) < 1,
            LEFT ( Sample_HR_Dataset_v2[First Name], 1 ) & ", ",
            Sample_HR_Dataset_v2[Middle Initial] & ", "
        ),
        Sample_HR_Dataset_v2[Last Name]
    )
)   

In the above formula, nested Power BI CONCATENATE function to accommodate the combination of more than 2 strings. IF function is used to conditionally concatenate the strings. And “&” operator is used to add spaces as separators.

The resulting output column “Cond_Full Names” is as follows:

Power BI CONCATENATE function: Sample table showing Full Names created  using CONCATENATE with a conditional Middle name initial.

4) Concatenation of Columns with Different Data Types

By concatenation of Columns with different Data Types means that you can create a concatenated column by concatenating two columns as arguments to the Power Bi CONCATENATE function but these columns don’t have the same data type.

The following example shows how to concatenate values from columns with different data types. If the value being concatenated is numeric, it will be implicitly transformed to text. If both values are numeric, they will be converted to text and concatenated as if they were strings.

Product descriptionProduct abbreviation (column 1 of composite key)Product number (column 2 of composite key)New generated key column
Mountain bikeMTN40MTN40
Mountain bikeMTN42MTN42

The formula for concatenating the columns as showcased in the above example:

= CONCATENATE('Products'[Product abbreviation],'Products'[Product number])  

The Power BI CONCATENATE function in DAX only takes two arguments, but the Excel CONCATENATE function takes up to 255. You may use the ampersand (&) operator to add extra arguments.

For example, the given formula also produces the same output, MTN-40 and MTN-42.

= [Product abbreviation] & "-" & [Product number]  

This is a prominent use for the Power BI CONCATENATE function. It might be a concatenation of Literals and Strings in Columns or any other form. Typical use cases include when you need to construct conditional dynamic visual headers or titles, or simply join columns with multiple data types to generate a unique column for creating connections in Power BI data modeling using bridge tables.

For further information on Power BI CONCATENATE function in DAX, you can visit here.

Conclusion

In this article, you have learned about Power BI CONCATENATE Function. This article also provided information on Power BI, its key features, DAX functions in Power BI, and the usage of Power BI CONCATENATE Function.

Hevo Data, a No-code Data Pipeline provides you with a consistent and reliable solution to manage data transfer between a variety of sources and a wide variety of Desired Destinations with a few clicks.

Visit our Website to Explore Hevo

Hevo Data with its strong integration with 100+ Data Sources (including 40+ Free Sources) such as Power BI allows you to not only export data from your desired data sources & load it to the destination of your choice but also transform & enrich your data to make it analysis-ready. Hevo also allows integrating data from non-native sources using Hevo’s in-built REST API & Webhooks Connector. You can then focus on your key business needs and perform insightful analysis using BI tools. 

Want to give Hevo a try? Sign Up for a 14-day free trial and experience the feature-rich Hevo suite first hand. You may also have a look at the amazing price, which will assist you in selecting the best plan for your requirements.

Share your experience of understanding the Power BI CONCATENATE Function in the comment section below! We would love to hear your thoughts.

Manisha Jena
Research Analyst, Hevo Data

Manisha Jena is a data analyst with over three years of experience in the data industry and is well-versed with advanced data tools such as Snowflake, Looker Studio, and Google BigQuery. She is an alumna of NIT Rourkela and excels in extracting critical insights from complex databases and enhancing data visualization through comprehensive dashboards. Manisha has authored over a hundred articles on diverse topics related to data engineering, and loves breaking down complex topics to help data practitioners solve their doubts related to data engineering.

No-code Data Pipeline for Power BI