Tableau is a strong information visualization device that’s rising in recognition and having fun with a wholesome market share. One of many causes for its recognition is its ease of use. Even customers with no coding expertise can create stunning and interactive advanced visualizations utilizing Tableau, making it a succesful enterprise analytics platform. The truth that it integrates properly with many various information sources is another excuse for its rising recognition.
One of the crucial generally requested questions by customers is learn how to concatenate in Tableau. When you’ve got ever needed to concatenate two fields collectively in Tableau, it’s truly loads simpler than you would possibly assume.
Bounce to:
Understanding concatenation
What’s concatenation? In on a regular basis English, to concatenate means to hitch collectively. In Tableau, concatenation is the method of mixing two or extra fields right into a single area. For instance, you possibly can concatenate a buyer’s first and final identify right into a single area. The outcome could be a single area containing the shopper’s full identify.
There are a number of the explanation why you would possibly wish to concatenate fields in Tableau. For one, it might make your information simpler to work with. For instance, for those who’re attempting to create a listing of all of your clients’ full names, it will be a lot simpler to do if these names had been saved in a single area. Moreover, concatenation might help you save house in your database. Should you retailer buyer names as two separate fields (first and final identify), that takes up twice as a lot house as storing them in a single area.
SEE: Study extra about learn how to use Tableau on this information for learners.
Lastly, concatenation can be utilized to create “calculated fields,” which is a area that’s generated by Tableau primarily based on the values in different fields. For instance, you possibly can use concatenation to create a area that comprises the total handle of every buyer (i.e., avenue handle, metropolis, state, ZIP code). By concatenating a number of fields right into a single area, you may make working together with your Tableau information a lot simpler.
Steps to concatenate in Tableau
To display, we’re utilizing a easy information desk that has six columns (Determine A): First Title, Final Title, Road Tackle, Metropolis, State and ZIP Code.
Determine A
1. Put together your dataset
Step one is to arrange your dataset. The information must be in a appropriate format resembling .xlsx or .csv. You may additionally must examine and edit points resembling date codecs and column headers to ensure the info is prepared to be used in Tableau.
2. Load the dataset
The following step is to attach the dataset to the Tableau dashboard. There are three strategies that you need to use to load a dataset into Tableau: importing a file, utilizing a connector or utilizing an accelerator. Step one is to click on New Information Supply on the Information Menu (Determine B).
Determine B
It will open the Hook up with Information window, the place you may choose the file you wish to use.
Importing a file is the best methodology — you may simply drag and drop the file into Tableau. Utilizing a connector is barely extra sophisticated, nevertheless it permits you to join Tableau to a variety of various information sources, together with Salesforce, Google Analytics and Amazon Redshift.
Accelerators are prebuilt dashboards you need to use to rapidly visualize your information. They’re greatest for inspiration and concepts and you may as well swap the present information with your personal. To make use of an accelerator, merely choose the Accelerators choice from the New Information Supply menu.
For this demonstration, we’re going to use the Add a File choice (Determine C). Merely drag and drop the dataset into Tableau.
Determine C
3. Perceive the info
Now that you just’ve loaded the dataset into Tableau, it’s time to try the info and perceive what it comprises. The very first thing you must do is open the Information Supply web page (you could find this below Information within the menu bar).
The Information Supply web page will present you the entire fields in your dataset in addition to their information sorts. It’s vital to know the info varieties of your fields as a result of it’ll decide how Tableau treats them once you begin constructing visualizations. For instance, drag the primary identify and final identify fields into the rows shelf to view the info (Determine D). The 2 fields are textual content fields (Abc).
Determine D
4. Concatenate a number of fields
Now that you just perceive the info, let’s concatenate the primary identify and final identify fields to create a single area for the folks’s names. To do that:
1. Click on the arrow subsequent to the search button, and click on Create Calculated Area from the menu dropdown (Determine E).
Determine E
2. Within the new window, give the sector a reputation (we’re calling it Full Title).
3. Drag the First Title area into the field after which the Final Title area. Guarantee you might have a separator (+ ” ” +) as proven in Determine F.
Determine F
It is advisable to put a separator, on this case, an area character, between the First Title and Final Title fields once you concatenate them, so Tableau is aware of they’re two completely different items of data. It will concatenate the First Title and Final Title fields, separated by an area, right into a single area known as Full Title.
4. Now, for those who drag this new area into the rows shelf, you will note that the info is displayed in another way (Determine G).
Determine G
Now, let’s repeat the identical course of for the Road Tackle, Metropolis, State and ZIP Code.
5. As soon as extra, click on Create Calculated Area.
6. Rename the sector Tackle, drag the 4 fields into the editor window, and add a separator between every area (Determine H). It will concatenate the varied handle parts right into a single area.
Determine H
7. As soon as the components is entered, click on OK to use it. The brand new area will now seem within the information pane and can be utilized like another area in Tableau.
8. Drag it into the row shelf to see the brand new information (Determine I).
Determine I
Utilizing the STR() operate to concatenate nonstring fields
One potential difficulty you might encounter when working with information in Tableau is concatenating nonstring fields. For instance, let’s say you might have a area for ZIP code that comprises solely integers. Should you attempt to concatenate this area with one other string area, you’ll get an error message.
To keep away from this downside, you need to convert the integer area right into a string utilizing the STR() operate. For instance, in our information, we transformed the ZIP code right into a string (Determine J).
Determine J
When you’ve achieved this, you’ll have the ability to concatenate the fields with none points. Maintain this in thoughts subsequent time you’re working with information in Tableau, and you must have the ability to keep away from any potential issues.
The way to concatenate a date and string area
In Tableau, you may as well concatenate a date and a string by utilizing the STR() operate to transform the date to a string first. Right here’s an instance:
Let’s think about a real-world instance of this — think about you’re the information analyst for a cellphone gross sales firm. You might have a dataset that features gross sales information for every product bought by the corporate. Every row within the dataset represents a single sale and consists of fields such because the date of the sale (SaleDate), the product bought (ProductName), and the amount bought (Amount) as proven in Determine Ok.
Determine Ok
You wish to create a brand new area that mixes the SaleDate and ProductName fields right into a single string, so that every distinctive mixture of a date and a product has its personal distinctive identifier. This could possibly be helpful for numerous causes, resembling figuring out particular gross sales transactions or creating distinctive labels for a visualization.
Right here’s how you’d do that in Tableau:
1. Click on on the arrow subsequent to the search button and choose Create Calculated Area from the dropdown.
2. Within the new window, give the sector a reputation (for instance, SaleIdentifier).
3. Within the components field, kind STR([SaleDate]) + ” ” + [ProductName]. This components converts the SaleDate area to a string after which concatenates it with the ProductName area, with an area in between (Determine L).
Determine L
4. Click on OK. The brand new SaleIdentifier area will now seem within the information pane and can be utilized like another area in Tableau.
Tableau will populate the ensuing SaleIdentifier area with concatenated strings that show the gross sales date and the product identify, as proven in Determine M. Every distinctive mixture of a date and a product may have its personal distinctive identifier on this area.
Determine M