Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

MDX Query returns no data ? Problem with DateTime Filtering .

$
0
0

Team , Grettings !

I have this query which  runs fine with commenting Date Range Filter fro BIDS MDX Designer .. But shows up Nothing when I Feed in Date Time Parameter

Thanks in advnace for your pointers ...

WITH MEMBER [Year Of Birth] AS 
[Patient].[Patient Year of Birth].MemberValue
-- Year of Birth as it appears in dimension value :  1918
-- Admit Date as it appears :  01/16/2006
MEMBER [Admit Date] AS 
RIGHT(HEAD( FILTER([Time].[DATE].children , [Measures].[Admission Count] > 0 )).item(0).member_value,4)

MEMBER [Age] AS
CASE WHEN ISEMPTY([Admit Date]) OR ISEMPTY([Year Of Birth]) THEN NULL
ELSE  CINT([Admit Date])-CINT([Year Of Birth]) END

MEMBER [Age Category] AS 
CASE WHEN ISEMPTY([Age]) THEN NULL
	 WHEN [Age]>0 AND [Age]<=24 THEN	'0-24'
	 WHEN [Age]>24 AND [Age]<=34THEN	'25-34'
	 WHEN [Age]>34 AND [Age]<=64 THEN	'35-64'
	 WHEN [Age]>64 AND [Age]<=74 THEN	'65-74'
	 WHEN [Age]>74 AND [Age]<=84 THEN	'75-84'
	 WHEN [Age]>84 THEN '85+'
ELSE NULL	 
END 	

SELECT 
		{ 
			[Admit Date],
		 	[Age],
			[Age Category]
			
		} ON 0 , 
	    
	NON EMPTY(  
		   [Patient].[Patient Year of Birth].[Patient Year of Birth].Members
		   
		 ) ON 1 
FROM [<<Cube Name>>]	
WHERE 
(
	STRTOMEMBER("[Time].[DIM TIME].&[" + Format(  CDate( @StartDate ) , "yyyyMMdd") + "]"):
	STRTOMEMBER("[Time].[DIM TIME].&[" + Format(  CDate( @EndDate )  , "yyyyMMdd") + "]")
, 
	STRTOSET( @BusinessUnit ),  
	STRTOSET( @PatientBranch )
)


Rajkumar Yelugu


Viewing all articles
Browse latest Browse all 14337

Trending Articles



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