dbTalk Databases Forums  

Switch MDX according to VALUE

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Switch MDX according to VALUE in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andrew A via SQLMonster.com
 
Posts: n/a

Default Switch MDX according to VALUE - 07-22-2005 , 09:52 AM







Hi,

I have an MDX code that works for Corporation1, and have other than works for
Corporation2
I want to implement a discrimiant like this:

iif(
[DimEnterprise].actual_member_value = corporation1
<code for corporation 1>,
<code fro corporation 2>
)

How can I implement this discriminant?

Thanks!


--
Message posted via http://www.sqlmonster.com

Reply With Quote
  #2  
Old   
Andrew A via SQLMonster.com
 
Posts: n/a

Default Re: Switch MDX according to VALUE - 07-22-2005 , 12:04 PM







Tryied this:

[DimEnterprise].CurrentMember is [DimEnterprise].&[BOOKSTORE_CO]

with no result....


--
Message posted via http://www.sqlmonster.com

Reply With Quote
  #3  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Switch MDX according to VALUE - 07-22-2005 , 08:26 PM



Did you get an error, and what kinds of values do the 2 possible iif()
branches represent?


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***

Reply With Quote
  #4  
Old   
Andrew A via SQLMonster.com
 
Posts: n/a

Default Re: Switch MDX according to VALUE - 07-23-2005 , 09:49 AM




Deepak,

I didn´t get an error.
Simply I have a MDX1 logic for Corporation1, and other (MDX2) for
Corporation2
In the same Cube I must implement 2 logics, one working for Co1 and other for
Co2.
Sepparately all works fine.

You want to know what is the real values?
Well, here is my code in english:

iif
(
[Enterprise].CurrentMember.Uniquename = [Store El S.A.].Uniquename , ------
<-----THIS LINE I´M TRYING
iif(isleaf([Product].currentmember),
-- <-------MDX1
iif(
[Measures].[C Area] = 0,
null,
[Measures].[S Area] / [Measures].[C Area]
),
Sum([Product].CurrentMember.children)
),
iif(
-- <-------MDX2
[Measures].[C Area] = 0,
null,
[Measures].[S Area] / [Measures].[C Area]
)
)

The LINE marked is the discriminant I must implement to follow MDX 1 or MDX2
The value for dimension Enterprise is [Store El S.A.]
The value in fact Table is '02'
(and for other enterprise is '03', only have 2 enterprises)

How can I implement some comparisson?


--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums...-olap/200507/1

Reply With Quote
  #5  
Old   
Jéjé
 
Posts: n/a

Default Re: Switch MDX according to VALUE - 07-23-2005 , 05:40 PM



when you say "Sepparately all works fine" what is separatly ?

Try this :
create 2 calculated members
the first one : MDX1=
iif(isleaf([Product].currentmember),
iif(
[Measures].[C Area] = 0,
null,
[Measures].[S Area] / [Measures].[C Area]
),
Sum([Product].CurrentMember.children, measures.MDX1)

the second MDX2=
iif(
[Measures].[C Area] = 0,
null,
[Measures].[S Area] / [Measures].[C Area]
)

and finally a third one:
iif (
[Enterprise].CurrentMember.Uniquename = [Store El S.A.].Uniquename ,
measures.mdx1
, measures.mdx2)

see what's appends in the 3 results.
you can then hide the mdx1 and mdx2 mesaures (visible = false)


"Andrew A via SQLMonster.com" <forum (AT) SQLMonster (DOT) com> wrote

Quote:
Deepak,

I didn´t get an error.
Simply I have a MDX1 logic for Corporation1, and other (MDX2) for
Corporation2
In the same Cube I must implement 2 logics, one working for Co1 and other
for
Co2.
Sepparately all works fine.

You want to know what is the real values?
Well, here is my code in english:

iif
(
[Enterprise].CurrentMember.Uniquename = [Store El S.A.].Uniquename
------
-----THIS LINE I´M TRYING
iif(isleaf([Product].currentmember),
-- <-------MDX1
iif(
[Measures].[C Area] = 0,
null,
[Measures].[S Area] / [Measures].[C Area]
),
Sum([Product].CurrentMember.children)
),
iif(
-- <-------MDX2
[Measures].[C Area] = 0,
null,
[Measures].[S Area] / [Measures].[C Area]
)
)

The LINE marked is the discriminant I must implement to follow MDX 1 or
MDX2
The value for dimension Enterprise is [Store El S.A.]
The value in fact Table is '02'
(and for other enterprise is '03', only have 2 enterprises)

How can I implement some comparisson?


--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums...-olap/200507/1



Reply With Quote
  #6  
Old   
 
Posts: n/a

Default Re: Switch MDX according to VALUE - 07-24-2005 , 08:09 AM



You mean something like:

iif([DimEnterprise].actual_member_value = corporation1, StrToValue(MDX1),
StrToValue(MDX2))

?


"Andrew A via SQLMonster.com" <forum (AT) SQLMonster (DOT) com> wrote

Quote:
Hi,

I have an MDX code that works for Corporation1, and have other than works
for
Corporation2
I want to implement a discrimiant like this:

iif(
[DimEnterprise].actual_member_value = corporation1
code for corporation 1>,
code fro corporation 2
)

How can I implement this discriminant?

Thanks!


--
Message posted via http://www.sqlmonster.com



Reply With Quote
  #7  
Old   
 
Posts: n/a

Default Re: Switch MDX according to VALUE - 07-24-2005 , 08:41 AM



Example against FoodMart 2000:

WITH MEMBER [Measures].[e] AS
'iif([Customers].CurrentMember.Properties("caption") = "USA",
StrToValue("([Product].[All Products].[Drink], [Time].[1997], [Unit
Sales])"), StrToValue("([Product].[All Products].[Food], [Time].[1997],
[Unit Sales])"))'
SELECT {[e]} on COLUMNS,
[Customers].[Country].Members on ROWS
FROM [Sales]

// MDX created using MDXBuilder Pro 2.0 - www.mdxbuilder.com


<E> wrote

Quote:
You mean something like:

iif([DimEnterprise].actual_member_value = corporation1, StrToValue(MDX1),
StrToValue(MDX2))

?


"Andrew A via SQLMonster.com" <forum (AT) SQLMonster (DOT) com> wrote in message
news:51B473A8E7302 (AT) SQLMonster (DOT) com...

Hi,

I have an MDX code that works for Corporation1, and have other than works
for
Corporation2
I want to implement a discrimiant like this:

iif(
[DimEnterprise].actual_member_value = corporation1
code for corporation 1>,
code fro corporation 2
)

How can I implement this discriminant?

Thanks!


--
Message posted via http://www.sqlmonster.com





Reply With Quote
  #8  
Old   
Andrew A via SQLMonster.com
 
Posts: n/a

Default Re: Switch MDX according to VALUE - 07-25-2005 , 10:08 AM




Hello. I tried this line according to Foodmart Example.
It still doesn´t use de MDX1
(of code:
iif discriminant = true,
MDX1,
MDX2)

The discriminant I use is
[DimEnterprise].CurrentMember.properties("caption") = "Store El S.A."
with no result using MDX1

The value in pivot Table is Store El S.A.
But in database is 02

I suppose with this code when I browse in Store EL S.A. see MDX1 result,
but when browse in Store EL SA children, not see this MDX.
So if it works I´ll need to implement an addicional code for browsing
children and parent.

I ask then If there is a way to use a discriminant according to database
value in stead of pivot table value.

Thanks.


--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums...-olap/200507/1

Reply With Quote
  #9  
Old   
 
Posts: n/a

Default Re: Switch MDX according to VALUE - 07-26-2005 , 05:06 AM



I'm sorry, but I do not fully understand the problem.

What do you mean by "Value in pivot table" and "Value in database"?

"Andrew A via SQLMonster.com" <forum (AT) SQLMonster (DOT) com> wrote

Quote:
Hello. I tried this line according to Foodmart Example.
It still doesn´t use de MDX1
(of code:
iif discriminant = true,
MDX1,
MDX2)

The discriminant I use is
[DimEnterprise].CurrentMember.properties("caption") = "Store El S.A."
with no result using MDX1

The value in pivot Table is Store El S.A.
But in database is 02

I suppose with this code when I browse in Store EL S.A. see MDX1 result,
but when browse in Store EL SA children, not see this MDX.
So if it works I´ll need to implement an addicional code for browsing
children and parent.

I ask then If there is a way to use a discriminant according to database
value in stead of pivot table value.

Thanks.


--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums...-olap/200507/1



Reply With Quote
  #10  
Old   
Andrew A via SQLMonster.com
 
Posts: n/a

Default Re: Switch MDX according to VALUE - 07-26-2005 , 10:13 AM




Sorry if my English is no good, and you can´t understand that problem.

When I refer value in Pivot Table, I mean the cell that shows in MS Excel,
the name of a member of a Dimension. Like [STORE EL]

When I mean Database value, I´m trying to refer the value of Fact Table, like:

Fact_Table/Column Enterprise/value '02' <-- for [STORE EL]

I tried all of them and no one of it could return True

[Enterprise].CurrentMember is [Enterprise].&[STORE EL],
[Enterprise].CurrentMember.level.name = "STORE EL",
[Enterprise].CurrentMember.name = "02",
[Enterprise].CurrentMember.Uniquename = [STORE EL].Uniquename ,
[Enterprise].CurrentMember.properties("caption") = "STORE EL",

Is there one that can return True? What could be wrong?


--
Message posted via http://www.sqlmonster.com

Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.