Showing posts with label children. Show all posts
Showing posts with label children. Show all posts

Sunday, March 25, 2012

Count Children

Hi

I have a time dimension, that has an hierarchy with three levels, Year, Half Year and Month.

Is it possible to count how many days there are in each level?

Regards

You should be able to do this using the "Existing" function to count the number of days using the attribute hierarchy for days. Here is an example using AdventureWorks:

WITH

MEMBER MEASURES.[Count of Days]

AS

{Existing [Date].[Date].[Date].Members}.Count

SELECT

{MEASURES.[Count of Days]} ONCOLUMNS,

Hierarchize(

{{[Date].[Calendar].[Calendar Year].Members},

{[Date].[Calendar].[Calendar Quarter].Members},

{[Date].[Calendar].[Month].Members}}) ONROWS

FROM

[Adventure Works]

HTH,

Steve

|||

Hi Guys

Working with the same hierarchy,

Is it possible to know the FirstChild and LastChild members in each level?

I'm trying to do this but I get an error #Error

WITH

MEMBER [Measures].[First Day]

AS

{[Tiempo].[Fecha].FirstChild}

select

[Measures].[First Day] ON COLUMNS

from [MyCube]

Regards

|||

If you return a "day" member, then you will have to create the member on your time hierarchy. Try the following:

MEMBER [Tiempo].[Fecha].[First Day]

AS

Head({Existing [Tiempo].[Fecha].DefaultMember.Children},1)(0)

MEMBER [Tiempo].[Fecha].[Last Day]

AS

Tail({Existing [Tiempo].[Fecha].DefaultMember.Children},1)(0)

HTH,

Steve

|||

Hi Steve, thanks for answer

Let me undenstand, Do I need to add the day level in my hierarchy?

Those new members aren't measures, they are Time dimension members. Aren't they?

Do you have an example about how to use it?

Regards