dbTalk Databases Forums  

Need help with IIF in MDX query

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


Discuss Need help with IIF in MDX query in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Kaisa M. Lindahl
 
Posts: n/a

Default Need help with IIF in MDX query - 10-10-2005 , 09:35 AM






I've been trying to figure out how to do a bit of quality checking through
either MDX or standard REporting Services tools for a few days, but I can't
figure out how to do this.

In a report, a user can query my Olap cube for any given ClientID. If this
client ID is not available in the OLAP cube (yet), my RS report returns a
nasty error message
"Formula error - cannot find dimension member
("[Client].[Custaccount].&[11]") - in a name-binding function."

So, what I want to do is to do a 2 step query:
1) Check if Client.Custaccount 11 is in the cube
2) If it is, do the query - if not, return "something" that I can do
something usefull with. Like setting all measure values to -1 or something,
that I can write some code for in my RS report designer.

It seems it's possible to do a bit of conditional statements, but I can't
figure out how to write it. All help is appreciated!

With regards,

Kaisa M. Lindahl



Reply With Quote
  #2  
Old   
SS
 
Posts: n/a

Default RE: Need help with IIF in MDX query - 10-10-2005 , 11:00 AM






Hi Kaisa:

You can do this by using a statement like

CREATE SET CustomerSet as 'FILTER([Customer].members,
[Customer].currentmember.properties("KEY") = "11") '

SELECT CustomerSet on ROWS

...... and so on.

The downside of this approach is that you might have a performance problem
if your customer dimension is too large.

Cheers.

Suranjan
"Kaisa M. Lindahl" wrote:

Quote:
I've been trying to figure out how to do a bit of quality checking through
either MDX or standard REporting Services tools for a few days, but I can't
figure out how to do this.

In a report, a user can query my Olap cube for any given ClientID. If this
client ID is not available in the OLAP cube (yet), my RS report returns a
nasty error message
"Formula error - cannot find dimension member
("[Client].[Custaccount].&[11]") - in a name-binding function."

So, what I want to do is to do a 2 step query:
1) Check if Client.Custaccount 11 is in the cube
2) If it is, do the query - if not, return "something" that I can do
something usefull with. Like setting all measure values to -1 or something,
that I can write some code for in my RS report designer.

It seems it's possible to do a bit of conditional statements, but I can't
figure out how to write it. All help is appreciated!

With regards,

Kaisa M. Lindahl




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

Default Re: Need help with IIF in MDX query - 10-10-2005 , 08:40 PM



This sample query for Foodmart 2000 Sales may help:

Quote:
With Member [Measures].[StoreID] as '25'
Member [Measures].[IsValidStore] as
'iif(IsError(StrToMember("[Store].&[" + CStr([Measures].[StoreID]) +
"]")),
"No", "Yes")'
Select {[Measures].[IsValidStore]} on columns
from Sales
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

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


Reply With Quote
  #4  
Old   
Kaisa M. Lindahl
 
Posts: n/a

Default Re: Need help with IIF in MDX query - 10-13-2005 , 10:08 AM



I used your suggestion, and it works like a charm! THanks a lot!
Just needed to change "create" to "with" and figure out how to escape the "s
in Reporting Services.

Kaisa

"SS" <SS (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi Kaisa:

You can do this by using a statement like

CREATE SET CustomerSet as 'FILTER([Customer].members,
[Customer].currentmember.properties("KEY") = "11") '

SELECT CustomerSet on ROWS

..... and so on.

The downside of this approach is that you might have a performance problem
if your customer dimension is too large.

Cheers.

Suranjan
"Kaisa M. Lindahl" wrote:

I've been trying to figure out how to do a bit of quality checking
through
either MDX or standard REporting Services tools for a few days, but I
can't
figure out how to do this.

In a report, a user can query my Olap cube for any given ClientID. If
this
client ID is not available in the OLAP cube (yet), my RS report returns a
nasty error message
"Formula error - cannot find dimension member
("[Client].[Custaccount].&[11]") - in a name-binding function."

So, what I want to do is to do a 2 step query:
1) Check if Client.Custaccount 11 is in the cube
2) If it is, do the query - if not, return "something" that I can do
something usefull with. Like setting all measure values to -1 or
something,
that I can write some code for in my RS report designer.

It seems it's possible to do a bit of conditional statements, but I can't
figure out how to write it. All help is appreciated!

With regards,

Kaisa M. Lindahl






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.