Languages Advisor | DAX
NUMBERVALUE Function in DAX
The NUMBERVALUE function in Data Analysis Expressions (DAX) converts text representation of numbers into a numeric data type. It is a powerful tool for converting textual data into numerical data types, allowing for more flexibility and sophisticated...
![Empty image or helper icon](/assets/data-mentor/hero-banner.jpg)
This Query related with thread "Calculating New Customers with DAX"
Prompt
What is the numbervalue function? Is this a new function?
Answer
NUMBERVALUE Function in DAX
The NUMBERVALUE
function is used in Data Analysis Expressions (DAX) to convert text representation of numbers into a numeric data type. If the text does not represent a valid number, the function returns an error.
Here is the syntax for using NUMBERVALUE
:
NUMBERVALUE(<text>[, <decimal_separator>[, <group_separator>]])
<text>
: The text you want to convert to a number.<decimal_separator>
: The character used as a decimal separator.<group_separator>
: The character used as a group separator.
Example
Assume you have a column, Cost
, with the following string values: "1,234.56", "$1234.56", and "£1.234,56". You can convert these text values into numbers using the NUMBERVALUE
function as shown below:
Column =
NUMBERVALUE([Cost], ".", ",")
Column =
NUMBERVALUE(REPLACE([Cost],1,1,""), ".", ",")
Column =
NUMBERVALUE(REPLACE([Cost],1,1,""), ",", ".")
These expressions convert the Cost
values into 1234.56, regardless of the original text format.
The NUMBERVALUE
function is not a new function in DAX. It has been part of DAX from the beginning, making the process of converting textual data into numeric data types more streamlined, providing better flexibility and making the creation of more sophisticated calculations possible.
Description
The NUMBERVALUE function in DAX is used to convert text representation of numbers into a numeric data type. It is particularly useful when dealing with imported data that may have numbers stored as text. This function takes the text as input and converts it into a number. If the text does not represent a valid number, an error is returned. The function allows the user to specify the decimal separator and group separator, providing flexibility in handling different number formats. The NUMBERVALUE function has been available in DAX from the beginning and is widely used for converting textual data into numerical data types, facilitating data analysis and calculations.