Did you get this resolved? I wish I could help you more, but I am really having trouble envisioning the solution. Forgetting the MDX for just a second, what would your pseudocode be?
You may be trying to do too much at once.
EDIT: Also, by just using IIF and NOT using SCOPE, your query performance will, more than likely, suffer. Check out Chris Webb's approach in this blog:
https://cwebbbi.wordpress.com/category/mdx/page/2/
I am hoping this triggers an idea for you.