0
votes

My date dimension contains only last day of each month, so I cannot count number of children in each month because it is always 1, and also same problem for year.

So, for given Date member, I will need to calculate number of days in that month and number of days in that year.

2
Fix your date dimensionmxix

2 Answers

0
votes

If I were you, I would start from the begining and I would add the columns you need in your table date (used by your dimension).

day_of_the_month: 1,2,3,..,30,31

day_of_the_year: 1,2,..,365/366

Then I would create the attribute dimensions based on what you need.

To finish, don't forget to modify attribute relationships

0
votes

Since your date dimension has just the last day of each month,I presume that all your fact values are bind to the last dates of months. The simplest way to have a count of days would be to add a column which contains the number of days of that particular month based on the date. So for instance For 31 Jan you, have the columns saying 31 for 28 Feb it says 28.

Keep this new attribute of number of days on rows. Now to display the number of days in a month you need a calculated measure like this.

WITH MEMBER [Measures].[DateValue] AS [Date].[Day of Month].CurrentMember.Properties ("Member_Value",TYPED)

Now display the number od days per year you can use this measure as below

WITH MEMBER [Measures].[DateValueYear] Sum (Date].[Year].CurrentMember,[Measures].[DateValue])