Email : info@epmstrategy.com | Call Us Now : 479-321-3977
:: Home :: Sitemap ::
Follow Us

Power BI – DAX ABS Function

By: David Rohlfs

Introduction

If you are not new to DAX, then you know that there are some functions that can save you a lot of time if you can remember to use them. One of these functions is the Absolute Value (ABS) function. What this function does is take the absolute value of a number.

In this blog we are going to go over when to use the ABS function and a short walkthrough demonstrating a way to use this function.

 

When to use it

As it is with any DAX function, there are a lot of reasons for the ABS function. But the good thing about this function is that there is one goal with the ABS function. Which is to take the absolute value of a number.

What is an absolute value? The absolute value is the value that a number is away from 0. So, if you have a number of 9.5, the absolute value would be 9.5. And if you have a number of -8.2, the absolute value would be 8.2. Using an absolute value effectively makes all your values positive.

One thing to remember if you use this function is that you need to describe this value to your end users. If you do an ABS function on a list of account transactions, it is likely that your end users will see this number as a sum and not a total transactions amount. You should use some key phrase that your organization knows or use the name of “Absolute Value”.

When you are using the ABS function in an equation, there will be two main ways. The first will be in a measure. In a measure you will probably have the ABS function nested inside of a different function. For instance:

If you have your ABS function inside of a calculated column or calculated table, then you have the option to leave the ABS function by itself, or nest it within a different function.

The syntax for the ABS function is as follows:

ABS([number or field])

 

Walkthrough

In this walkthrough we are going to go through using the ABS function inside of a measure. Our goal will be to get the total amount that flowed through a transaction account. We do not want the sum, but instead the amount that flowed through the account.

To start we need to click on the table we want to work on, then the ellipses next to that table, and select new measure. You should have an equation bar appear on the top center of your screen.

Now we can write our equation. The image below is what my equation turned out to be. Once you are done you can click the check mark to the right of the equation bar.

Now we are going to put this measure into a table. Notice that each of the values is effectively positive.

 

Conclusion

While the ABS function is not one that you will use very often, it is one that can save lots of time and is worth learning. If you liked this blog, then I suggest reading through some of EPM Strategy’s other blogs that are related to DAX linked below.

 

Links to Related Articles:

DAX Calculate Function

DAX If statement

Understanding the Basics of Using Variables in DAX

DAX HasOneValue

Conditional Formatting with DAX

Comments

One Response to “ Power BI – DAX ABS Function ”

 

Leave a Reply

You must be logged in to post a comment.