Left() returns a string consisting of the first (leftmost) characters of the input string, where the number of characters is determined by the second argument.
Syntax:
Left(text, count)
Return data type: string
Arguments
Argument
Description
text
The original string.
count
Defines the number of characters to included from the left-hand part of the string text.
Example: Chart expression
Example
Result
Left( 'abcdef', 3 )
Returns abc
Example - Left fundamentals
Overview
Open the Data load editor and add the load script below to a new tab.
The load script contains:
A dataset which is loaded into a data table called Example.
This example parses the order codes in a dataset, which contain a region code, year, and order number, to create a new field for data analysis.
Open the Data load editor and add the load script below to a new tab.
The load script contains:
A dataset which is loaded into a data table called Example.
The following fields in the data table:
OrderID
CustomerName
SalesAmount
Load script
Example:
Load * inline [
OrderID, CustomerName, SalesAmount
US2024001, John Doe, 1500
EU2024002, Jane Smith, 2300
AS2024003, Mike Davis, 1800
];
Results
Load the data and open a sheet. Create a new table and add these fields as dimensions:
OrderID
CustomerName
SalesAmount
Create the following calculated dimension:
=Left(OrderID, 2) to calculate the region.
Results table
OrderID
CustomerName
SalesAmount
Left(OrderID, 2)
AS2024003
Mike Davis
1800
AS
EU2024002
Jane Smith
2300
EU
US2024001
John Doe
1500
US
The output from the Left function parses the OrderID to extract the region, creating a new field to use for further data analysis.
Example - Left advanced scenario
Overview
This example parses the product codes in a dataset, which contain a department category code and a unique identifier, to create a new field for data analysis.
Open the Data load editor and add the load script below to a new tab.
The load script contains:
A dataset which is loaded into a data table called Example.
When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. The information does not usually directly identify you, but it makes the site work as you expect it to and can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies by clicking on the different category headings to find out more and change your settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
Privacy & Cookie Notice
Manage Consent Preferences
Strictly Necessary Cookies
Always Active
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work.
Functional Cookies
These cookies enable the website to provide enhanced functionality and personalization. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies, then some or all of these services may not function properly. These cookies do not typically store personal information enabling us to identify you, but are based on uniquely identifying your browser and internet device.
Performance Cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site and make it easier to navigate. For example, they help us to know which pages are the most and least popular and see how visitors move around the site. When analyzing this data it is typically done on an aggregated (anonymous) basis.
Advertising Cookies
These cookies may be set through our site by our advertising partners to build a profile of your interests and show you relevant advertisements on other sites. They do not typically store personal information enabling us to identify you, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less relevant advertising.