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

Head OR Tail oR something else to eliminate duplicate(s) ?

$
0
0

Team ,

I'm trying to  count Patient Admissions after eliminating any re-admissions in same fiscal year .  Can some please provide some pointers ?

Here is my sample so far :

WITH MEMBER [Measures].[Gender UnDuplicated Admission Count] AS 
SUM(
		[Time].[Date].children *
		[Time].[Year].&[2004-01-01T00:00:00] * 
		[Patient].[X] ,
		 IIF(   [Measures].[Admission Count]>0
			   , 1
			   , NULL
			 )
   )

SELECT [Measures].[Gender UnDuplicated Admission Count] ON COLUMNS,
	   ([Time].[Year].&[2004-01-01T00:00:00]) ON ROWS
FROM [Patient Admissions]

Here the output being :

Year  UnDuplicatedCount

2004 3

I need to consider   this as only one count , since patient [X] is re admitted in the same year thrice for three differnt dates with 

[Time].[Date].children 

So i'm thinking i need to pick the recent OR Last date entity  from [Time].[Date].Children  ??

Thanks in advance for your time !


Rajkumar Yelugu



Viewing all articles
Browse latest Browse all 14337

Trending Articles