Functions
M Number Functions
Number Functions
M number functions like Number.Round process numeric data.
Introduction to M Number Functions
M number functions are crucial in Power Query for processing numeric data. They allow you to perform various operations, such as rounding, converting, and manipulating numbers to suit your data transformation needs.
In this guide, we will explore some of the most commonly used M number functions and how they can be applied in practical scenarios.
Rounding Numbers with Number.Round
The Number.Round function is used to round a number to a specified number of decimal places. This can be particularly useful when dealing with financial data or when you need to limit the precision of your numbers.
The syntax of the Number.Round
function is as follows:
Here's an example of how to use Number.Round
in Power Query:
In this example, Number.Round
rounds the number 123.4567 to two decimal places, resulting in 123.46.
Other Useful Number Functions
Apart from Number.Round
, there are several other number functions in M that can help you process numeric data. Here are a few:
- Number.Abs: Returns the absolute value of a number.
- Number.Mod: Computes the remainder of a division operation.
- Number.Power: Raises a number to the power of a specified exponent.
- Number.Sqrt: Calculates the square root of a number.
Example: Using Number.Abs
The Number.Abs
function is useful for removing any negative signs from a number, effectively returning its absolute value. Here's how you can use it:
In this example, Number.Abs
converts -42 to 42.
Example: Using Number.Mod
The Number.Mod
function is useful for finding the remainder of a division operation. Here's an example:
Here, Number.Mod
returns 1, which is the remainder when 10 is divided by 3.
Conclusion
M number functions are versatile and essential for working with numeric data in Power Query. By mastering these functions, you can effectively manipulate and transform your data to meet your specific needs.
Continue exploring other number functions to further enhance your data processing skills.
Functions
- Previous
- Text Functions
- Next
- Date Functions