Number.Log10

D

T

The M Code Behind the Power Query M function Number.Log10

Syntax

The syntax for the Number.Log10 function is as follows:


Number.Log10(number as nullable number) as nullable number


The function takes in one argument, the number for which you want to calculate the base-10 logarithm. The function returns the base-10 logarithm of the number.

The M Code

The M code for the Number.Log10 function is as follows:


let

numberLog10 = (number as nullable number) as nullable number =>

if number = null then null else Number.Log10(number)

in

numberLog10


The code defines a function called numberLog10, which takes in one argument, number. If the number is null, the function returns null. Otherwise, it calls the built-in Power Query M function Number.Log10 with the number as the argument and returns the result.

Usage

To use the Number.Log10 function in Power Query, follow these steps:

1. Open Power Query in Excel.

2. Select the data you want to work with.

3. Click on the "From Table/Range" button on the "Home" tab.

4. In the "Power Query Editor" window, click on the "Add Column" tab.

5. Click on the "Custom Column" button.

6. In the "Custom Column" dialog box, enter a name for the new column.

7. In the "Custom Column" dialog box, enter the following formula: `Number.Log10([Column Name])`

8. Click "OK" to close the dialog box.

9. The new column will be added to the table with the base-10 logarithm of the selected column.

You can also use the Number.Log10 function in a formula bar by entering the following formula:


= Number.Log10(number)


Replace "number" with the number for which you want to calculate the base-10 logarithm.

The Number.Log10 function in Power Query M is a useful function for calculating the base-10 logarithm of a number. The M code behind the function is simple and easy to understand. By using this function, you can quickly calculate the order of magnitude of a number and make informed decisions based on the results.

In summary, we have covered the syntax, M code, and usage of the Power Query M function Number.Log10. With this knowledge, you can now use this function to calculate the base-10 logarithm of a number in Power Query.

Power Query and M Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)