In my Date Dimension I have 2 hierarchies:

**[Year - Week - Date]** and **[Year - Month - Date]**

I want to check in a Cube Calculation if the current level of the Date Dimension is [Date] (the lowest level) or something higher. 

How can I achieve this?

**Background:** I need this to calculate how many working days there were in a period, for an employee.
I currently have this code (untested) that should do the trick for 1 hierarchy, but I guess this will fail when users are using the [Year - Week - Date] hierarchy.

```
CASE WHEN
    [Date].[Year - Month - Date].CURRENTMEMBER.Level
IS
    [Date].[Year - Month - Date].[Date]
THEN
    //at day level,

    //if there is any duration booked, this is a working day
    IIF([Measures].[Duration] = 0,0,1)

ELSE
    //at higher than day level,

    //count days
    COUNT(
        // where duration > 0 (employee work day)
        FILTER(
            Descendants([Date].[Year - Month - Date].CURRENTMEMBER, [Date].[Year - Month - Date].[Date]),
            [Measures].[Duration] > 0
        )
    )

END

```

**tl;dr** how do I make the above code also work for [Year - Week - Date] hierarchy in the cleanest way possible.