Right() returns a string consisting of the last (rightmost)
characters of the input string, where the number of characters is determined by the second argument.
Syntax:
Right(text, count)
Return data type: string
Arguments
Argument
Description
text
The original string.
count
Defines the number of characters to be included from the rightmost part of the string text.
Example: Chart expression
Example
Result
Right( 'abcdef', 3 )
Returns def
Example - Right 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 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
US1000001, John Doe, 1500
EU3000002, Jane Smith, 2300
AS2000003, 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:
=Right(OrderID, 7) to split out the order number.
Results table
OrderID
CustomerName
SalesAmount
Right(OrderID, 7)
AS2000003
Mike Davis
1800
2000003
EU3000002
Jane Smith
2300
3000002
US1000001
John Doe
1500
1000001
Compare the output of the Right function with the input OrderID. The calculated dimension derives a numeric value that can now be used for tasks such as sorting the output in numerical order rather than alphabetical.
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!