LN

LN

How to Use the Power BI DAX function LN

What is the LN Function?

The LN function is a type of mathematical function used to calculate the natural logarithm of a given number. The natural logarithm is the logarithm to the base e, where e is an irrational constant approximately equal to 2.71828.

In Power BI, you can use the LN function to calculate the natural logarithm of a column of numbers. This can be useful when you’re trying to analyze data that follows an exponential distribution.

How to Use the LN Function in Power BI

To use the LN function in Power BI, you’ll first need to create a new measure. Here’s how to do it:

1. Open Power BI and go to the “Data” tab.

2. Select the table that contains the column of numbers you want to calculate the natural logarithm for.

3. Click on “New Measure” under the “Modeling” tab.

4. In the formula bar, enter the following formula:


LN = LN(column name)


5. Replace "column name" with the name of the column you want to calculate the natural logarithm for.

6. Press "Enter" to create the measure.

Once you've created the measure, you can use it in a visual or a table. Simply drag the measure onto the visual or table, and Power BI will automatically calculate the natural logarithm of the numbers in the column.

Examples of Using the LN Function in Power BI

Let's take a look at a couple of examples of using the LN function in Power BI.

Example 1: Calculating the Natural Logarithm of Sales Data

Suppose you have a table that contains sales data for your company. The table has two columns: "Date" and "Sales." You want to analyze the sales data to see how it has grown over time.

To do this, you can create a new measure using the LN function to calculate the natural logarithm of the sales data. Here's how to do it:

1. Go to the "Data" tab in Power BI.

2. Select the table that contains the sales data.

3. Click on "New Measure" under the "Modeling" tab.

4. In the formula bar, enter the following formula:


LN Sales = LN(Sales)


5. Press "Enter" to create the measure.

Once you've created the measure, you can use it in a visual to plot the growth of the sales data over time.

Example 2: Analyzing the Distribution of Product Prices

Suppose you have a table that contains product data for your company. The table has three columns: "Product Name," "Price," and "Category." You want to analyze the distribution of product prices for each category.

To do this, you can create a new measure using the LN function to calculate the natural logarithm of the product prices. Here's how to do it:

1. Go to the "Data" tab in Power BI.

2. Select the table that contains the product data.

3. Click on "New Measure" under the "Modeling" tab.

4. In the formula bar, enter the following formula:


LN Price = LN(Price)


5. Press "Enter" to create the measure.

Once you've created the measure, you can use it in a visual to analyze the distribution of product prices for each category.

The LN function is a powerful tool for analyzing data in Power BI. By using the LN function, you can calculate the natural logarithm of a column of numbers, which can be useful when you're trying to analyze data that follows an exponential distribution. Hopefully, this article has given you a better understanding of how to use the LN function in Power BI.

Power BI DAX 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)

Copyright, G Com Solutions Ltd, 2024.
Tower Bridge Business Centre, 46-48 East Smithfield, London E1W 1AW
0800 998 9248   |   9:00 a.m. till 5:30 p.m.

Connect With Me: