Please note javascript is required for full website functionality.

Blog

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

29 August 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 ERROR

 

The ERROR function

The ERROR function raises an issue with an error message when triggered.  This function does not return any value and it has the following syntax:

ERROR(text)

It has one [1] argument:

  • text: this is a text string containing an error message.

Here are a few remarks about the ERROR function:

  • the ERROR function will stop the execution and raise an error with the description provided as arguments
  • the ERROR function can be placed in a DAX expression anywhere a scalar value is expected.
  • the ERROR function is not compatible with Power Pivot and currently it is only compatible with Power BI, SSAS Tabular, Azure As and SSDT.

Let’s test out this function with an example here:

We have an Example table here with two [2] random number columns.  Next, we will create an aggregation for Random Number 1 column:

Then we can write a DIVIDE function with an ERROR function inside it:

This will result in the following visual:

When we click the See details option, we will see the error message we wrote in the measure earlier:

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