Results 1 to 4 of 4

Thread: Converting from MDX to SQL

  1. #1
    Join Date
    Jun 2011
    Posts
    6

    Converting from MDX to SQL

    Hi all
    May I know how the below query can be converted to SQL query?? I am not able to understand how this can be written in SQL....

    WITH MEMBER Measures.x AS [Date].[Calendar].[Calendar Quarter].Ordinal
    SELECT Measures.x on 0
    FROM [Adventure Works]


    It would be great help if anybody come up with the answer

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    How convert to t-sql? Can't query cube with t-sql.

  3. #3
    Join Date
    Jun 2011
    Posts
    6

    MDX to SQL conversion

    I have corresponding DW(based on which cube is created) in the server. I have column mappings as well. I am not able to understand what is the logic are they trying to put in the below query. I have a calculated measure for which the formula is like this
    CASE WHEN [_Date Count] IS NULL THEN NULL
    WHEN [Date].[Days Calendar].CurrentMember.Level.Ordinal = 0
    AND [Date].[Days Fiscal].CurrentMember.Level.Ordinal = 0
    AND [Date].[Long Days Fiscal].CurrentMember.Level.Ordinal = 0
    AND [Date].[Long Weeks Fiscal].CurrentMember.Level.Ordinal = 0
    AND [Date].[Months Calendar].CurrentMember.Level.Ordinal = 0
    AND [Date].[Weeks Fiscal].CurrentMember.Level.Ordinal = 0
    THEN
    (
    [Measures].[ResellerSales]
    ,[Date].[Days Calendar].[Calendar Year].&[CY2014].LastSibling

    )
    ELSE
    (
    [Measures].[InternetSales]
    ,[Date].[Days Calendar].[Calendar Year].&[CY2014].LastSibling
    )
    END
    )

  4. #4
    Join Date
    Sep 2002
    Posts
    5,938
    Take look at 'Using GROUP BY with ROLLUP, CUBE, and GROUPING SETS' in books online.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •