Handling Division Failure

Reza Rad looks at how division can go wrong in Power Query:

In this example I just returned zero if I find error. but you can return error message if you like with [Revenue Per Item][ErrorMessage]. This method is great error handling method when an error out of blue happens in your data set. I always recommend using TRY method to get rid of errors that might stop the whole solution to work properly.

I have to mention that steps above are separated to show you how the output of try expression looks like. In fact you can combine both steps above in single step with TRY OTHERWISE as below (Thanks to Maxim Zelensky for pointing this out);

The end result is code which is a bit more complex, but safely handles a number of edge cases.

Related Posts

Jitter In Power BI Charts

Rob Collie shows how to incorporate jitter in Power BI scatter charts: Now, sometimes you may WANT multiple rows to combine into one dot, but in this particular case, I want to see each row of my source data as its own dot. When adding a new calculated column, there are LOTS of ways to uniquely […]

Read More

Power BI Image Timeline

Devin Knight continues his Power BI custom visuals series: In this module you will learn how to use the Image Timeline Custom Visual.  The Image Timeline is a great way to display data in order across a timeline.  If you have images of your data you can also display those images on the timeline. This […]

Read More

Categories

June 2016
MTWTFSS
« May Jul »
 12345
6789101112
13141516171819
20212223242526
27282930