LEN
The LEN function returns a number of characters in a text string.
Applicable to
Calculated Columns
Return Value
- The LEN function return integer value representing the number of characters in the input text string.
- If the input is NULL or BLANK, the function returns NULL.
Remark
- The LEN function is often used to determine the length of a text string, which can be useful for various purposes such as validating input, manipulating strings, or formatting output.
- LEN function is applicable only for text values.
Syntax
LEN(<expression>)
LEN in Calculated Columns
Expression | A placeholder in a function that is replaced with the actual column name. |
---|---|
Column Name | The name of the column in the dataset or Datasource that contains the values you want to analyze. |
Steps to Use LEN Function
- Write the LEN function. For instance
LEN(<expression>)
- Replace
<expression>
withVALUE([Column Name]).
- Replace the Column Name with the actual name of your column required.
- To learn how to add calculated columns in Infoveave, visit the section Calculated Columns.
ExampleObjective Consider that you have the below sales dataset, your goal is to find the length of the CUSTOMER ID to verify the number of characters.
ORDER DATE | CUSTOMER ID | CATEGORY | UNIT PRICE | MARKET PRICE | QUANTITY |
---|---|---|---|---|---|
2024-01-03 | CUSTID124 | Baby Food | 38.41 | 43.7874 | 2 |
2024-01-07 | CUSTID182 | Spices | 45.56 | 50.8155 | 20 |
CUSTID1285 | 43.7874 | 10 | |||
2024-01-18 | 32.3019 | 4 | |||
2024-01-22 | CUSTID8527 | Cosmetics | 28.335 | 23.0109 | 7 |
2024-01-26 | CUSTID5288 | 20.185 | 23.0109 | 9 | |
2024-01-04 | CUSTID1245 | Cereal | 25.26 | 28.7964 | 9 |
2024-01-09 | CUSTID2525 | Cereal | 44.575 | 50.8155 | 8 |
2024-01-14 | CUSTID2325 | Snacks | 20.185 | 4 | |
CUSTID262 | Cosmetics | 40.485 | 46.1529 | 2 |
You can use the LEN function like
LEN(VALUE([CUSTOMER ID]))
The new calculated column ” Text ” will return
ORDER DATE | CUSTOMER ID | CATEGORY | UNIT PRICE | MARKET PRICE | QUANTITY | TEXT LENGTH |
---|---|---|---|---|---|---|
03-01-2024 | CUSTID124 | Baby Food | 38.41 | 43.7874 | 2 | 9 |
07-01-2024 | CUSTID182 | Spices | 45.56 | 50.8155 | 20 | 9 |
CUSTID1285 | 43.7874 | 10 | 10 | |||
18-01-2024 | 32.3019 | 4 | ||||
22-01-2024 | CUSTID8527 | Cosmetics | 28.335 | 23.0109 | 7 | 10 |
26-01-2024 | CUSTID5288 | 20.185 | 23.0109 | 9 | 10 | |
04-01-2024 | CUSTID1245 | Cereal | 25.26 | 28.7964 | 9 | 10 |
09-01-2024 | CUSTID2525 | Cereal | 44.575 | 50.8155 | 8 | 10 |
14-01-2024 | CUSTID2325 | Snacks | 20.185 | 4 | 10 | |
CUSTID262 | Cosmetics | 40.485 | 46.1529 | 2 | 9 |