![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Hi Matthias, The problem here is that the IIF function can only return either a numeric value or a string value - not a set value as you're trying to do here. The |
|
with set [myCustomers] as '{[Customers].[All Customers], [Customers].[City].members}' set [myProducts_TOP] as '{ [Product].[All Products]}' set [myProducts_Cat] as '{[Product].[Product Category].members}' set [theRows] as 'generate( {myCustomers}, nonemptycrossjoin( {[customers].currentmember}, strtoset( iif(Customers.currentmember.level is [Customers].[City], "ORDER([myProducts_Cat],[Measures].[Unit Sales], BDESC)", "ORDER([myProducts_TOP],[Measures].[Unit Sales], BDESC)") ) ))' set [theColumns] as '{[Measures].[Unit Sales]}' select [theColumns] on columns, [theRows] on rows from sales HTH, Chris ----- Matthias Englert wrote: ----- I want to have an MDX that creates different kinds of crossjoins on the rows, depending on the level of the current member in the first dimension plus I want to have a sorting within the inner dimension. My idea was to use an iif()-function for the second set in the generate()-function. I' ve already tried different ways to implement but all without succes.... Thanks for any help, Matthias with set [myCustomers] as '{[Customers].[All Customers], [Customers].[City].members}' set [myProducts_TOP] as '{ [Product].[All Products]}' set [myProducts_Cat] as '{[Product].[Product Category].members}' set [theRows] as 'generate( {myCustomers}, {iif(myCustomers.currentmember.level.name = "City", {nonemptycrossjoin( {[mycustomers].currentmember}, {ORDER([myProducts_Cat], [Measures].[Unit Sales], BDESC)})}, {nonemptycrossjoin({[mycustomers].currentmember}, {ORDER([myProducts_TOP], [Measures].[Unit Sales], BDESC)})} ) } )' set [theColumns] as '{[Measures].[Unit Sales]}' select [theRows] on rows, [theColumns] on columns from sales |
![]() |
| Thread Tools | |
| Display Modes | |
| |