Go Back   CORTEX Forums > Local Happenings > CORTEX Blogs > Random Procrastination
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read

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 ...


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 8th February 2012, 01:25 AM   #1
Senior Member
 
Join Date: Jun 2009
Posts: 63
Darren Gosbell is on a distinguished road
Thumbs up Do DAX and MDX need a safe divide operator?

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...
Darren Gosbell is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTweet this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT +11. The time now is 04:00 PM.

© The Business Intelligence Group

Search Engine Optimization by vBSEO