dbTalk Databases Forums  

Text in measures

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


Discuss Text in measures in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Michael Vardinghus
 
Posts: n/a

Default Text in measures - 08-01-2005 , 02:58 PM






Hi

I like to use calc measures to display member properties. How come this
don't work:

iif([RammeDelKontoAkt].currentmember.level.ordinal =
1,[RammeDelKontoAkt].currentmember.properties("Antal Poster")+" poster i
"+[RammeDelKontoAkt].currentmember.properties("Måned")+"/
"+[RammeDelKontoAkt].currentmember.properties("År"),null)

...but this does

iif([RammeDelKontoAkt].currentmember.level.ordinal =
1,[RammeDelKontoAkt].currentmember.properties("Antal Poster")+" poster i
"+[RammeDelKontoAkt].currentmember.properties("Måned")+"/
"+[RammeDelKontoAkt].currentmember.properties("År"),"")

That actually bugs me.....the last one isn't what I want - because "" will
display empty cells as well.

Are there any other ways to do this ?



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

Default Re: Text in measures - 08-01-2005 , 07:19 PM






http://groups-beta.google.com/group/...rver.olap/msg/
cec78b442eb1c21e
Quote:
Newsgroups: microsoft.public.sqlserver.olap
From: Deepak Puri <deepak_p... (AT) progressive (DOT) com>
Date: Wed, 20 Apr 2005 14:42:26 -0700
Subject: Re: iif() problem

There is a well-known issue when combining a string with NULL in iif(),
which you may be encountering. Using a second measure to "hide" the text
may work, like:

[Measures].[Text1] :

Right([Measures].[Codigo Data Venc Titulo],2) + "/" +
Mid([Measures].[Codigo Data Venc Titulo], 5, 2) + "/" +
Left([Measures].[Codigo Data Venc Titulo],4)


[Measures].[Text2] :

iif(IsEmpty([Measures].[Codigo Data Venc Titulo]),
NULL, [Measures].[Text1])
...
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

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


Reply With Quote
  #3  
Old   
Michael Vardinghus
 
Posts: n/a

Default Re: Text in measures - 08-02-2005 , 05:24 AM



Thanx Deepak

That worked...I actually did try the second measure by saying = "" but I had
to use the ISEMPTY instead.


"Deepak Puri" <deepak_puri (AT) progressive (DOT) com> wrote

Quote:
http://groups-beta.google.com/group/...rver.olap/msg/
cec78b442eb1c21e

Newsgroups: microsoft.public.sqlserver.olap
From: Deepak Puri <deepak_p... (AT) progressive (DOT) com
Date: Wed, 20 Apr 2005 14:42:26 -0700
Subject: Re: iif() problem

There is a well-known issue when combining a string with NULL in iif(),
which you may be encountering. Using a second measure to "hide" the text
may work, like:

[Measures].[Text1] :

Right([Measures].[Codigo Data Venc Titulo],2) + "/" +
Mid([Measures].[Codigo Data Venc Titulo], 5, 2) + "/" +
Left([Measures].[Codigo Data Venc Titulo],4)


[Measures].[Text2] :

iif(IsEmpty([Measures].[Codigo Data Venc Titulo]),
NULL, [Measures].[Text1])
..



- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.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.