MDX Queries - Current Day - Month and Year

Problem: Query to get Current Day - Month and Year in MDX


/* MDX for retrieving current Year */
WITH MEMBER [Measures].[Current Year] AS
    VBAMDX.Format(VBAMDX.Now(),"yyyy")
SELECT
  {[Measures].[Current Year]} ON COLUMNS
FROM [Analysis Services Tutorial];


/* Current Month */
WITH MEMBER [Measures].[Current Month] AS
    VBAMDX.Format(VBAMDX.Now(),"MM")
SELECT
  {[Measures].[Current Month]} ON COLUMNS
FROM [Analysis Services Tutorial];


/* MDX for retrieving current Date */
WITH MEMBER [Measures].[Current Date] AS
    VBAMDX.Format(VBAMDX.Now(),"dd")
SELECT
  {[Measures].[Current Date]} ON COLUMNS
FROM [Analysis Services Tutorial];



Comments

Popular posts from this blog

Calculating Age of the person in T-SQL

How to Troubleshoot Subscription issue in Reporting Services