none
suggestion on code ..

    Question

  • iif([Calendartime].currentmember.Heriarchy.uniqueName is Day,0,1)  .. want to check the currentmember heriarchy name ..can you please help 


    If giving error .. invalid token when i am trying to save it .. 
    Friday, May 29, 2009 10:16 AM

Answers

  • First is it not called Heirarchy. Right spelling -> hierarchy
    Second: the IS function expected a Member Name not a Value. Use = to check for Value
    Third: If you want to know on wich Level you are (Year, Month, Day) You need to use then Level Function like

    [Date].[Calendar].

    level.name

    So there are this options
    IIF(([Calendar_time].Level is ([Calendar_time].[Day],1,0) --Using Level Member

    or

    IIF(([Calendar_time].Level.Name = "Day",1,0) --Using Level Naming (Caption)

     

     


    Visit my Blog at my Company ComeUp GmbH & Co. KG to contact me
    • Marked as answer by santoshdvn Friday, May 29, 2009 12:31 PM
    Friday, May 29, 2009 12:05 PM

All replies

  • I think this helps. In your Code Heriarchy is wrong, it's called hierarchy
    WITH
    
    Member Measures.[Name] as [Date].[Calendar].member_name
    Member Measures.[UniqueName] as [Date].[Calendar].uniquename
    Member Measures.[HierUniqueName] as [Date].[Calendar].hierarchy.uniquename
    Member Measures.[Caption] as [Date].[Calendar].member_caption
    Member Measures.[Key] as [Date].[Calendar].member_Key
    Member Measures.[Value] as [Date].[Calendar].member_value
    Member Measures.[Level] as [Date].[Calendar].level.ordinal
    Member Measures.Test as
    IIF( [Date].[Calendar].level is [Date].[Calendar].[Calendar Year]
    ,"Year"
    ,IIF( [Date].[Calendar].level is [Date].[Calendar].[Calendar Semester]
    	,"Semester"
    	,IIF( [Date].[Calendar].level is [Date].[Calendar].[Calendar Quarter]
    		,"Quarter"
    		,IIF( [Date].[Calendar].level is [Date].[Calendar].[Month]
    			,"Month"
    			,IIF( [Date].[Calendar].level is [Date].[Calendar].[Date]
    				,"Date"
    				,"n. def."
    				)
    			)
    		)
    	)
    )
    
    select {
    [Measures].[Internet Sales Amount]
    , Measures.[Name]
    , Measures.[UniqueName]
    , Measures.[HierUniqueName]
    , Measures.[Caption]
    , Measures.[Key]
    , Measures.[Value]
    , Measures.[Level]
    , Measures.[Test]
    } on 0,
    DESCENDANTS([Date].[Calendar].[Calendar Year].&[2001]) on 1
    from [Adventure Works]
    ;

    Visit my Blog at my Company ComeUp GmbH & Co. KG to contact me
    Friday, May 29, 2009 10:31 AM
  • Also possible is Level Naming

    Member Measures.[HierUniqueName] as [Date].[Calendar].level.name

    Visit my Blog at my Company ComeUp GmbH & Co. KG to contact me
    Friday, May 29, 2009 10:33 AM
  •  [Date].[Calendar].level.name will give you the name of the level .. 

    if it is at the year heirarchy .. ...and in year . it has 2006,2007,2008...


    level.name will be like - 2006,2007,2008
    Friday, May 29, 2009 10:55 AM
  • WITH 
    MEMBER [Measure].[UHname] as [Calendar_time].Heirarchy.uniqueName
    iif([Calendar_time].currentmember.Heirarchy.Name is [Measure].[UHname].Day,0,1)

    can you check the code and tell what wrong i was doing ..
    Friday, May 29, 2009 11:13 AM
  • First is it not called Heirarchy. Right spelling -> hierarchy
    Second: the IS function expected a Member Name not a Value. Use = to check for Value
    Third: If you want to know on wich Level you are (Year, Month, Day) You need to use then Level Function like

    [Date].[Calendar].

    level.name

    So there are this options
    IIF(([Calendar_time].Level is ([Calendar_time].[Day],1,0) --Using Level Member

    or

    IIF(([Calendar_time].Level.Name = "Day",1,0) --Using Level Naming (Caption)

     

     


    Visit my Blog at my Company ComeUp GmbH & Co. KG to contact me
    • Marked as answer by santoshdvn Friday, May 29, 2009 12:31 PM
    Friday, May 29, 2009 12:05 PM