Early Access: The content on this website is provided for informational purposes only in connection with pre-General Availability Qlik Products. All content is subject to change and is provided without warranty.
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.