Convert and Calculate: Strings to Numbers and Numbers to Strings
In SAP Analytics Cloud, convert a string value to a numeric value or a numeric value to a string value and use the new values in calculated dimensions or measures.
-
ToNumber converts string values to numbers
-
ToText converts numeric values to strings
ToText uses an existing calculated dimension in its calculations.
-
In Builder, under Dimensions, select .
-
In the Calculation Editor under Type, select Calculated Dimension.
-
Create your formula.
ExampleToNumber ([d/ACT_EMPLOYEE_NUMERIC:Age_String].[p/ID])
ToText requires an existing calculated dimension.
-
In Builder, under Dimensions, select .
-
In the Calculation Editor under Type, select Calculated Dimension.
-
Create your formula.
ExampleToText (<ToNumber calculated dimension> ) + " years"
The string and number conversion functions can be combined with Measure-Based dimensions (in a calculated dimension) to create measure to dimension conversions. For more information about Measure-Based dimensions, see Create Measure-Based Dimensions.
There is also a calculation type that lets you convert a dimension to a measure.
-
Add a chart to the canvas.
-
In Builder, choose .
-
From Dimension Attribute to Convert, select a dimension.
-
Select context dimensions.
-
Set the aggregation operation type.
-
Select OK and review the results in the chart.