This is ok for returning Existing employees (flagged Y in attribute 'Existing'). Issue is I am attempting to bring back the parent 'Total Employee' too, but as soon as I filter by 'Y' the 'Total Employee' does not have attribute flagged so is removed.
I cannot flag 'Total Employee' as Y as this will cause the same issue with another subset for new employees (which filters by '')
For something simple like this you can also just use the "+" operator to join sets rather than using UNION. (Used to be important in the old days of 256 character limits for MDX strings, less so now)
And here is the output from a view that has nested Region and Business Unit on rows:
+ QLD + All_Business_Unit 3,611,664.50
+ QLD 7420 188,370.98
+ QLD 8064 112,490.48
+ QLD 10233 95,354.71
+ QLD 10238 -1,500.00
+ QLD 10243 196,988.08
+ QLD 10266 73,647.77
+ QLD 10268 146,821.05
+ QLD 16539 148,067.04
2 things are wrong here:
1. All the n levels summed give 960,240.11, but All_Business_Unit = 3,611,664.50 , I need it be the sum 960,240.11
2. I need no other regions to show, although I have hard coded 1 region here (QLD), IF I had other regions(i.e NSW VIC etc) then they would also be returned even though they do not relate to "Jimi Hendrix" in my example
1. All the n levels summed give 960,240.11, but All_Business_Unit = 3,611,664.50 , I need it be the sum 960,240.11
You're expecting MDX to function in a way that it cannot. MDX can only filter which elements to display, it cannot change the definition of the elements. If the node All_Business_Unit includes all the business units in the dimension, then any cube view showing that element will always include the sum of all the business units, regardless of which of those children elements you choose to display underneath it. The only way to do what you want to do is to create an alternate hierarchy in the dimension, which cannot be done via MDX.
2. I need no other regions to show, although I have hard coded 1 region here (QLD), IF I had other regions(i.e NSW VIC etc) then they would also be returned even though they do not relate to "Jimi Hendrix" in my example
I believe the EXCEPT expression is what you need here.