Quantcast
Channel: SQL Server Analysis Services Forum
Viewing all articles
Browse latest Browse all 2472

MDX - show empty in MTD for the rest of month.

$
0
0

Hi, 

I want to display NULL (empty) value for the future MTD. I believe it's something like i have to use iff statement with date comparison.
Not sure how to convert and compare dates using iif and now() function.

Could someone please help ?

CREATE MEMBER CURRENTCUBE.[Date dimension].[calendar Date dimension Calculations].[Month to Date]
 AS "NA", 
VISIBLE = 1;  

Scope(
       {
         [Measures].[Sales Cnt]
       }
);  

// Month to Date
  ( 
	[Date dimension].[calendar Date dimension Calculations].[Month to Date],
    [Date dimension].[cal month].[cal month].Members,
	[Date dimension].[dim_date_key].Members 
  ) 
  
  =
  
  Aggregate(
             { [Date dimension].[calendar Date dimension Calculations].[Current Date dimension] } 
             *
             PeriodsToDate(
                            [Date dimension].[calendar].[cal month],
                            [Date dimension].[calendar].CurrentMember
             )
  );  

  
End Scope; 

Basically, I want to show MTD value up until today, after today, I want to show empty for the rest of current month. 

Thanks !



Viewing all articles
Browse latest Browse all 2472

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>