Showing posts with label expression. Show all posts
Showing posts with label expression. Show all posts

Monday, March 19, 2012

Measure Expression in Query ?

Hi - I want to do a query like this, in management studio, but it is giving me an error message.

select sum({TopCount([Asset].[Asset].[Asset].members,5,([Portfolio].[Portfolio].&[DD2342342],[Measures].[Value Base]))}, [Measures].[Portfolio Weighting]) on columns
from [MIQB Daily]

I tried different strto.. functions but didn't find any proper solution.

The Axis0 function expects a tuple set expression for the argument. A string or numeric expression was used.

Thanks

Noordin

Hi Noordin,

Unfortunately you can't just insert an MDX expression that returns a value on an axis - you have to declare a calculated member first, use the expression as its definition, and then place the calculated member on the axis. Here's an example from Adventure Works:

with member measures.demo as

sum(topcount([Date].[Date].[Date].members, 5, [Measures].[Internet Sales Amount]), [Measures].[Internet Sales Amount])

select {measures.demo, [Measures].[Internet Sales Amount]} on 0,

[Product].[Category].members on 1

from

[Adventure Works]

HTH,

Chris

|||

Thanks Chris,

Actually I was playing with Excel 2007 cube... formulas ... may be I need to do some work around.

do you have an idea of #IND value, what does it mean, is it infinity?

Regards

Noordin

|||I'm afraid I don't have an install of Office 2007 handy at the moment, so I'm not sure. Anyone else? #IND isn't what AS will return for infinity though - it returns 1.#INF.

Me!Value in matrix subtotal

G'day all,
Trying to set a property, for instance foreground color, based on Me!Value expression in a matric subtotal with an expression like:
=IIf(Me.Value < 0, "Red", "Black")
produces the following error:
The color expression for the matrix â'matrix1â' contains an error: [BC30456] 'Value' is not a member of 'ReportExprHostImpl.EH_matrix1.EH_MatrixDynamicGroup_...
jez_UK posted a similar question which is unanswered on July 14th, but my question is on Me!Value was different enough to warrant a new post.
Thanks in advance,
Thomas WilliamsI assume you clicked on the green triangle for the subtotal properties, and
modified the color expression for the subtotal. This won't work, because
every matrix cell is just a "container" for multiple reportitems (in your
case the matrix cell probably just contains one textbox). Only textboxes
would support Me.Value but not rectangles, etc. Therefore the compilation of
the expression results in an error.
You have to do this using an expression in textboxes of the matrix data
cells (assuming you have one column/row grouping called matrix1_ProdCat):
=iif(InScope("matrix1_ProdCat"), "Green", iif(Me.Value < 0, "Red", "Black"))
The expression above would do two things:
* regular matrix cell (which are in the scope of the matrix1_ProdCat
grouping) will have a green color
* subtotal matrix cells (which are not in the scope of the grouping) will
have red or black color based on the current textbox value.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Thomas Williams" <thomasswilliams@.hotmail.com> wrote in message
news:AE48347D-440C-4E91-97EC-234F464F871B@.microsoft.com...
> G'day all,
> Trying to set a property, for instance foreground color, based on Me!Value
expression in a matric subtotal with an expression like:
> =IIf(Me.Value < 0, "Red", "Black")
> produces the following error:
> The color expression for the matrix 'matrix1' contains an error: [BC30456]
'Value' is not a member of
'ReportExprHostImpl.EH_matrix1.EH_MatrixDynamicGroup_...
> jez_UK posted a similar question which is unanswered on July 14th, but my
question is on Me!Value was different enough to warrant a new post.
> Thanks in advance,
> Thomas Williams|||Hi Robert, thanks for the reply, now I've got to figure out the scope of my groupings (3 row groups, 1 column group) and create an "IIf" statement to cover them.
Thanks again mate!
"Robert Bruckner [MSFT]" wrote:
> I assume you clicked on the green triangle for the subtotal properties, and
> modified the color expression for the subtotal. This won't work, because
> every matrix cell is just a "container" for multiple reportitems (in your
> case the matrix cell probably just contains one textbox). Only textboxes
> would support Me.Value but not rectangles, etc. Therefore the compilation of
> the expression results in an error.
> You have to do this using an expression in textboxes of the matrix data
> cells (assuming you have one column/row grouping called matrix1_ProdCat):
> =iif(InScope("matrix1_ProdCat"), "Green", iif(Me.Value < 0, "Red", "Black"))
> The expression above would do two things:
> * regular matrix cell (which are in the scope of the matrix1_ProdCat
> grouping) will have a green color
> * subtotal matrix cells (which are not in the scope of the grouping) will
> have red or black color based on the current textbox value.
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Thomas Williams" <thomasswilliams@.hotmail.com> wrote in message
> news:AE48347D-440C-4E91-97EC-234F464F871B@.microsoft.com...
> > G'day all,
> >
> > Trying to set a property, for instance foreground color, based on Me!Value
> expression in a matric subtotal with an expression like:
> > =IIf(Me.Value < 0, "Red", "Black")
> >
> > produces the following error:
> > The color expression for the matrix 'matrix1' contains an error: [BC30456]
> 'Value' is not a member of
> 'ReportExprHostImpl.EH_matrix1.EH_MatrixDynamicGroup_...
> >
> > jez_UK posted a similar question which is unanswered on July 14th, but my
> question is on Me!Value was different enough to warrant a new post.
> >
> > Thanks in advance,
> >
> > Thomas Williams
>
>|||I was redirected to this post from another. I am still having problems, though this post has clarified the Why and the What. I am at a loss for How.
What does "You have to do this using an expression in textboxes of the matrix data cells" mean? I take that to mean I need to make a textbox somewhere (I cannot use the provided subtotal matrix cell). Do you mean I have to delete the subtotal (and corresponding text box) and somehow manually add a textbox to the group and write an expression to get the value(the subtotal) and an expression to change the text color? Any help is greatly appreciated - I am spinning on this right now.
Thanks.
"Robert Bruckner [MSFT]" wrote:
> I assume you clicked on the green triangle for the subtotal properties, and
> modified the color expression for the subtotal. This won't work, because
> every matrix cell is just a "container" for multiple reportitems (in your
> case the matrix cell probably just contains one textbox). Only textboxes
> would support Me.Value but not rectangles, etc. Therefore the compilation of
> the expression results in an error.
> You have to do this using an expression in textboxes of the matrix data
> cells (assuming you have one column/row grouping called matrix1_ProdCat):
> =iif(InScope("matrix1_ProdCat"), "Green", iif(Me.Value < 0, "Red", "Black"))
> The expression above would do two things:
> * regular matrix cell (which are in the scope of the matrix1_ProdCat
> grouping) will have a green color
> * subtotal matrix cells (which are not in the scope of the grouping) will
> have red or black color based on the current textbox value.
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Thomas Williams" <thomasswilliams@.hotmail.com> wrote in message
> news:AE48347D-440C-4E91-97EC-234F464F871B@.microsoft.com...
> > G'day all,
> >
> > Trying to set a property, for instance foreground color, based on Me!Value
> expression in a matric subtotal with an expression like:
> > =IIf(Me.Value < 0, "Red", "Black")
> >
> > produces the following error:
> > The color expression for the matrix 'matrix1' contains an error: [BC30456]
> 'Value' is not a member of
> 'ReportExprHostImpl.EH_matrix1.EH_MatrixDynamicGroup_...
> >
> > jez_UK posted a similar question which is unanswered on July 14th, but my
> question is on Me!Value was different enough to warrant a new post.
> >
> > Thanks in advance,
> >
> > Thomas Williams
>
>|||Don't delete the subtotal. However, instead of clicking on the green
triangle in the matrix heading, you click on the actual matrix data cell
which will show your data (most likely the matrix cell contains a textbox in
your case). The matrix cell probably contains an expression like
=Sum(Fields!Sales.Value)
For the conditional formatting of the cell content you will then use an
expression as outlined below:
=iif(InScope("matrix1_ProdCat"), "Green", iif(Me.Value < 0, "Red", "Black"))
If you have multiple row/column groupings in the matrix you will need to
take them into account when using the InScope function to determine if the
cell at runtime is a "subtotal cell" or a regular "data cell".
More information on InScope is available at:
http://msdn.microsoft.com/library/en-us/RSCREATE/htm/rcr_creating_expressions_v1_0jmt.asp
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Getting started and liking it" <Getting started and liking
it@.discussions.microsoft.com> wrote in message
news:6A6F92A4-59AA-4B90-8A5A-433E85B3A8B6@.microsoft.com...
> I was redirected to this post from another. I am still having problems,
though this post has clarified the Why and the What. I am at a loss for How.
> What does "You have to do this using an expression in textboxes of the
matrix data cells" mean? I take that to mean I need to make a textbox
somewhere (I cannot use the provided subtotal matrix cell). Do you mean I
have to delete the subtotal (and corresponding text box) and somehow
manually add a textbox to the group and write an expression to get the
value(the subtotal) and an expression to change the text color? Any help is
greatly appreciated - I am spinning on this right now.
> Thanks.
> "Robert Bruckner [MSFT]" wrote:
> > I assume you clicked on the green triangle for the subtotal properties,
and
> > modified the color expression for the subtotal. This won't work, because
> > every matrix cell is just a "container" for multiple reportitems (in
your
> > case the matrix cell probably just contains one textbox). Only textboxes
> > would support Me.Value but not rectangles, etc. Therefore the
compilation of
> > the expression results in an error.
> >
> > You have to do this using an expression in textboxes of the matrix data
> > cells (assuming you have one column/row grouping called
matrix1_ProdCat):
> > =iif(InScope("matrix1_ProdCat"), "Green", iif(Me.Value < 0, "Red",
"Black"))
> >
> > The expression above would do two things:
> > * regular matrix cell (which are in the scope of the matrix1_ProdCat
> > grouping) will have a green color
> > * subtotal matrix cells (which are not in the scope of the grouping)
will
> > have red or black color based on the current textbox value.
> >
> > --
> > This posting is provided "AS IS" with no warranties, and confers no
rights.
> >
> >
> > "Thomas Williams" <thomasswilliams@.hotmail.com> wrote in message
> > news:AE48347D-440C-4E91-97EC-234F464F871B@.microsoft.com...
> > > G'day all,
> > >
> > > Trying to set a property, for instance foreground color, based on
Me!Value
> > expression in a matric subtotal with an expression like:
> > > =IIf(Me.Value < 0, "Red", "Black")
> > >
> > > produces the following error:
> > > The color expression for the matrix 'matrix1' contains an error:
[BC30456]
> > 'Value' is not a member of
> > 'ReportExprHostImpl.EH_matrix1.EH_MatrixDynamicGroup_...
> > >
> > > jez_UK posted a similar question which is unanswered on July 14th, but
my
> > question is on Me!Value was different enough to warrant a new post.
> > >
> > > Thanks in advance,
> > >
> > > Thomas Williams
> >
> >
> >

Monday, March 12, 2012

MDX Set Expression Converts to Constants (and I don't want this to happen)

First, I should mention this problem is occuring in Proclarity 6.1 with an underlying SSAS 2005 cube.

We want a rolling 12 month window displayed in our chart. I have written:

SELECT { Tail(Filter([Time].[Month].Members,Not IsEmpty(Time.CurrentMember)),12)} ON COLUMNS ,

Which works just fine when I enter it. But when the Proclarity book is altered in anyway (say, by changing from one measure to another), this MDX expression is converted ("instantiated" ? is that the right word ?) to constants:

SELECT { [Time].[All Time].[2005].[Quarter 3].[August], [Time].[All Time].[2005].[Quarter 3].[September], [Time].[All Time].[2005].[Quarter 4].[October], [Time].[All Time].[2005].[Quarter 4].[November], [Time].[All Time].[2005].[Quarter 4].[December], [Time].[All Time].[2006].[Quarter 1].[January], [Time].[All Time].[2006].[Quarter 1].[February], [Time].[All Time].[2006].[Quarter 1].[March], [Time].[All Time].[2006].[Quarter 2].[April], [Time].[All Time].[2006].[Quarter 2].[May], [Time].[All Time].[2006].[Quarter 2].[June], [Time].[All Time].[2006].[Quarter 3].[July] } ON COLUMNS ,

Does anyone know how to prevent this ?

Using a named set for your time expression will prevent this. In ProClarity Desktop Professional, create a named set using your time expression, next use the named set in your query. Now save the results of this query to a briefing book.|||

gbraach:

Thanks for your assistance. I did follow your advice, and created a named set. ("Rolling12Months"). Then, my select statement becomes:

SELECT { [<##<SET!DASCOTT!Rolling12Months>##>] } ON COLUMNS ,

Which again works just fine, but unfortunately becomes constants when I change the measure from fees to record count. Thus:

SELECT { [Time].[All Time].[2005].[Quarter 3].[August], [Time].[All Time].[2005].[Quarter 3].[September], [Time].[All Time].[2005].[Quarter 4].[October], [Time].[All Time].[2005].[Quarter 4].[November], [Time].[All Time].[2005].[Quarter 4].[December], [Time].[All Time].[2006].[Quarter 1].[January], [Time].[All Time].[2006].[Quarter 1].[February], [Time].[All Time].[2006].[Quarter 1].[March], [Time].[All Time].[2006].[Quarter 2].[April], [Time].[All Time].[2006].[Quarter 2].[May], [Time].[All Time].[2006].[Quarter 2].[June], [Time].[All Time].[2006].[Quarter 3].[July] } ON COLUMNS ,

I'm still stumped.

Friday, March 9, 2012

MDX reference link?

Hi, all here,

Could anyone advise where can I find the MDX expression references then? Thanks a lot.

The link is as below:

http://msdn2.microsoft.com/en-us/library/ms145506.aspx

MDX reference link?

Hi, all here,

Could anyone advise where can I find the MDX expression references then? Thanks a lot.

The link is as below:

http://msdn2.microsoft.com/en-us/library/ms145506.aspx

Monday, February 20, 2012

MDX in KPI Value Expression

Hi,

I'm having some problems when developing a couple of KPI's in analysis services. I'd like them to calculate new contracts and renewal of contracts. I have a measure called [Contract Count] which i want to use but i need this to be filtered by the specific contract type member. In my KPI Value expression i have the folowing:

{[Measures].[Contract Count], [Contract].[By Contract Type].[ContractType].&[Renewal]}

I get the following error when i try to run this:

Members belong to different hierarchies in the function

Can anyone suggest what i'm doing wrong. I'm new to MDX and believed that this was the way to get return the required set.

Any help would be much appreciated.

Thanks in advance,

Grant

Hi all,

Apologies, my bad. I've found that i've been using {} instead of () parentheses.

It's working now.

Grant