1

I'm new to MDX (my background is SQL).

I'm working on a SSAS project where I have a fact table that contains date column and another attribute InscriptionYear that stores a year as an integer. I have a date dimension already set up.

Example of the data in the fact table:

DateID | InscriptionYear | ...

20130515 | 2013 | ...

20130515 | 2012 | ...

etc.

I want to create a calculated measure that will count the number of records (using date dimension will be required) but will also filter by the InscriptionYear attribute (it should take the year from the date dimension and subtract one year).

Example:

In the cube I would like to have a calculated measure InscriptionsLastYear. I have date dimension filtered to 2013-05-13 I would like to count the records on that day that have the value of InscriptionYear=2012 in the fact table.

How can this be done in MDX?

4

0 回答 0