| |
| ||||||
Do DAX and MDX need a safe divide operator?This is a discussion on Do DAX and MDX need a safe divide operator? within the Random Procrastination forums, part of the CORTEX Blogs category; I’ve been teaching an MDX course for the last few days as well as reading Marco and Alberto’s excellent PowerPivot book on the train and it struck me that every ... |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
| | #1 |
| Senior Member Join Date: Jun 2009
Posts: 63
![]() | I’ve been teaching an MDX course for the last few days as well as reading Marco and Alberto’s excellent PowerPivot book on the train and it struck me that every time I do a division in both languages I seem to be using the following pattern in order to avoid returning an error to the user MDX: IIF( = 0, NULL, / )** DAX: IF( = 0, BLANK(), / ) I know that languages like C++ and C# don’t test for this automatically as it’s an extra operation that is not always required. So I've sort of been pre-conditioned into thinking this is normal. But particularly in DAX, which is supposed to be as simple and user friendly as possible, I was thinking that the divide operator should do this automatically or we should have something like a SafeDivide() function or maybe a different operator. If you want the calculation to behave differently when the denominator is 0 or blank then you could still specifically test for that, but at the moment I can’t think of a compelling reason where I would want to show the user a “divide by 0” error. Chris Webb has had a suggestion up on connect for a while to have this feature added to MDX here: https://connect.microsoft.com/SQLSer...-zero-operator And Marco just added one for DAX here: https://connect.microsoft.com/SQLSer...-zero-operator Go and vote if you think this would be a good thing to have. Get More from the original blog... |
| | |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Keeping secrets safe from Google | Latest News Headlines | Latest News | 0 | 1st June 2011 12:19 PM |
| Do DAX and MDX need a safe divide operator? | Darren Gosbell | Random Procrastination | 0 | 19th November 2010 09:50 AM |
| Is it Safe to Be High on the Highway? | admin | Prediction Markets News Feeds | 0 | 9th November 2010 07:05 AM |
| Is user data safe in the cloud? | Latest News Headlines | Other International Vendors | 0 | 25th September 2010 01:14 AM |
| Telstra safe from NBN Co poaching | Latest News Headlines | 2010 Q1 News Headlines | 0 | 9th March 2010 05:07 AM |
| | |
| | |