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

Playing Blackjack With Power BI

Phillip Seamark goes and creates a blackjack game in Power BI: The last of the three data-tables in the model used to control Player 1 is the ‘P1 Turn’ data-table.  This is simply a 10-row single column table with numbers 1 through 10.  The purpose of this table is to use in conjunction with a slicer […]

Read More

Making Power BI Reports Accessible

Meagan Longoria has a checklist for ensuring that your Power BI reports are accessible to all users: Tooltips Don’t use tooltips to convey important information. Users with motor issues and users who do not use a mouse will have difficulties accessing them. Do add tooltips to charts as ancillary information. It is included in the […]

Read More

Categories

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