First of all my knowledge on MDX is very basic. We are currently trying to migrate a Tabular SSAS cube to Multidimensional cube due to the increasing volume of underlying data. As part of this, we are translating all the calculated fields in the Tabular model to MDX calculated measures. We have two type of calculated fields:
Calculated measures based other dimension attributes. e.g. Sales in a particular currency (Sales in USD * GBP Rate). First issue we faced with calculated measure if the fact that while browsing the cube, these values are showing unless the related fields are selected (e.g. GBP Rate). THe current work around is to use Scope function on a unique ID in the Fact table to do the calculation. E.g.
CREATE MEMBER [Measures].[Sales in GBP] As 0; Scope([Fact Table].ID.[All]); [Measures].[Sales in GBP]=[Measures].[Sales in USD] * [FxRate].[GBPRate]; End Scope;
Is this the correct way to handle this issue. Any advise on this would be really helpful.
Calculated fields based on various "text" attributes in the dimension Data. Some examples for this are listed below: Populate "Artist" field with value fro DimArtist.Name if Fact.Artist is NULL/Blank. We are currently creating a calculated Measures (which is not ideal) to create this field. I am not sure on how to correctly use the scope function to get the desired output.
If Fact.Source = 'XYZ', ProductID = XYZDimProduct.ProductID, if Fact.Source = 'ABC', ProductID = ABCDimProduct.ProductID else ProductID = DimProduct.ProductID.
The intend is to replicate the DAX calculated columns which is calculated at the lowest granular level.
PS: I have not posted the actual queries due to IP issues. Please let me know if I need explain it with a better example.
Thanks in Advance, Venki