none
How To Calculate WTD,MTD,YTD in T-SQL?

    Question

  • Hi,

    I have a requirement lets say i.e to create the MTD,WTD sales for a column based on the given date.I can do it in MDX because we have the date cals defined but i dont know how to do it in t-sql can some one help me please?

    My Mdx query looks like this

    with
    set [Date] as [Date].[Hierarchy - Fiscal].[Date].&[20121118]

    member [Fcst] AS SUM([Date] * [Fiscal Date Calculations].[Date Calculation].&[MTD],[Measures].[Gross Demand Dollars])

    select {[Fcst]} on 0 from edw

    Now i have to get the MTd for the given date and lets say column name is Gross_dollars from temp table.

    Anyhelp will be appreciated.

    Thanks,

    Sujith.

    Tuesday, November 20, 2012 6:24 PM

Answers

All replies