The .evaluateScalar call won't give you the value of the dimension member-- it pushes that member into context and evaluates the cell at that intersection.
To grab the member name (in this case -1, 1), use the Properties function. For example:
cast( [Store Size in SQFT].CurrentMember.Properties("MEMBER_NAME") as Integer)
grabs the name of the member from the Store Size dimension and casts it to an Integer.
You could do something like
Measures.CA * cast( [Lignes].[SNS_0].CurrentMember.Properties("MEMBER_NAME") as Integer)
Or, if you will be doing anything more complex with your UDF, you can pass these in as parameters.
Thank you mcampell !!!
It seems work with negative SNS_0 but I dont understand why it show me only negative value ...
As you can see in the picture, instead of positive values, I have -0 ...
I continue to search but If you have an idea...
Thank you again ! you are very helpfull for me
In the report in your screenshot, the CurrentMember of [Lignes].[SNS_0] is the default member (since it's not explicitly in the query). So you're multiplying the value of the default member (I'm guessing -1) by the measure value for everything. If you crossjoin Lignes in your report you'll probably see a different breakdown.
Can a Magasin have more than one Lignes?
Yes it can have more than one Lignes!
AMTNOTLIN_0 is the field that used in "old" [Measures].[CA]:
This field is in the same table as SNS_0 so I created a level in order to do the crossjoin:
Is it correct ? so, how can I cross join Lignes in ? I am sorry , I am novice in MDX
I tried to create a calculated Member like this :
But I give me error ...
Last edited by OMDCAPSYS; 10-02-2013 at 08:57 AM.
I was suggesting to crossjoin Lignes.SNS_0 on the report (that is, drag SNS_0 to the left or right of magasins), just to verify that you then get a breakdown you would expect based on the 1/-1 values. If that looks correct to you, we can start thinking about how to get the correct aggregate value when SNS_0 is not explicitly in context.
Last edited by mcampbell; 10-02-2013 at 01:31 PM.
Very good idea ! When I put SNS_0 with Magasin it's work ! But how can I do without SNS_0 ?
You'll now need to create a calculated member that rolls up the set of SNS_0 members. Something like
I get an error "NaN"...
Can you post the whole stack trace? Also, what does your formula look like now?
In writing you an answer, I've realized a careless mistake.
That's why I had that "Nan". The error is corrected handling works very well ...
Thank you for all your help, without it I would not have succeeded