SQL Server Performance

How to get month's number?

Discussion in 'Analysis Services/Data Warehousing' started by anli, May 17, 2005.

  1. anli New Member

    Hi All!

    I neeed to get a month's number with MDX. For examle if [Date].CurrentMember.Name = Mai, the number is 5.

    Thanks,
    Andrej.
  2. ranjitjain New Member

    did u mean this

    SELECT "Month Number" = MONTH('03/12/1998')
    GO

    Here is the result set:

    Month Number
    ------------
    3

  3. ghemant Moderator

    the current month is MAY and if u execute the statement like follow :

    select month(getdate())


    you would get the result as : --- it will return the month number
    -----------------------
    5

    hsGoswami
    ghemant@gmail.com
  4. Mahesh B. Paranjpe New Member

    I think you are looking for this answer

    IIF ( time.CURRENTMEMBER.LEVEL.ORDINAL <> [Time].[Month].ORDINAL , NULL,
    IIF([TIME].CURRENTMEMBER.NAME ="5",5,NULL))

    Assume in time dimension, there are 3 levels

    Time------>
    Year
    Quarter
    Month

    If you want to check for MAY then you have to build your dimension in such way that MAY month name should be displayed.

Share This Page