Tuesday, March 27, 2012

Calculated member

Hello (sory i don( speack very well english)
I want to build a new calculated member in my cube, but i don't know MDX .
I want the same result that this SQL request :
--
SELECT count(Distinct Code)
FROM dbo.Fact_Project
Where
ID_Time=4 and ID_Currency=2 and ID_CBU=31 and Montant<>0

ID_Time, ID_Currency and ID_CBU are dimension member.
Is it possible to find the same result in MDX.
Thank you

Guillaume

Hi Guillaume,

I think what you actually want to do is not create a calculated member, but create a real measure on your Code column with aggregation type 'Distinct Count'. This will display the distinct count of the number of values in the Code column as a measure.

HTH,

Chris

|||Hi Chris
Thank you for your solution, i created a new mesure in a tree view who use Distinct Count. But i have a new question, is it possible to put a filter in this mesures because i don't want the Montant (amount) equals to 0.
thx|||

Probably the easiest way of doing this would be to add a boolean field to your fact table (or create a named calculation in your dsv) which returned true if Montant=0 and false otherwise. You could then create a new dimension in your cube with one attribute and two members: Montant=0 and Montant<>0. Selecting the first of these members in your query would then allow you to filter out all transactions where Montant=0.

HTH,

Chris

No comments:

Post a Comment