Please note javascript is required for full website functionality.

Blog

Power Pivot Principles: The A to Z of DAX Functions – EVEN

19 September 2023

In our long-established Power Pivot Principles articles, we continue our series on the A to Z of Data Analysis eXpression (DAX) functions.  This week, we look at EVEN

 

The EVEN function

If DAX frustrates you, don’t get mad, get EVEN.

The EVEN function is one of the math and trig functions which returns numbers rounded up to the nearest even integer.  

You can use this function for processing items that come in twos.  For example, a packing crate accepts rows of one or two items.  The crate is full when the number of items, rounded up to the nearest two, matches the crate's capacity.

It has the following syntax:

EVEN(number)

It has one [1] argument here:

  • number: a value to round.

Further, it should be noted:

  • if the number is non-numeric, the EVEN function returns an error message
  • regardless of the sign of the number, a value is rounded up when adjusted away from zero [0]. 
  • if the number is an even integer, no rounding occurs
  • this function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.

Consider using EVEN with the values -14.1, 14, “29.1” and “One”.  Let’s create the following measures to test EVEN out:

As we can see here the value -14.1 is rounding to -16 instead of -14 as we mentioned before the value is rounding away from zero [0].  Hence, the number returned is -16.

As we can see here, the number is not rounded up to the next even number in this case.

The next example we have here is to deal with a number in form of a text string.  As you can see here the EVEN function will convert the text into value and then perform the rounding.  

Although we were able to pass through the formula checking protocol in the Measure dialog we were unable to put this measure in the PivotTable and obtain the above error message instead.

 

Come back next week for our next post on Power Pivot in the Blog section.  In the meantime, please remember we have training in Power Pivot which you can find out more about here.  If you wish to catch up on past articles in the meantime, you can find all of our Past Power Pivot blogs here.

Newsletter