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

DateDifference based on selected date while browsing cube

$
0
0

Hi,

I have a requirement to find #of people waiting for >28 days based on selected Date in SSAS. 

My fact table consists of the following columns (WL = Waiting List):

-WLIST_REFNO (WL Reference Number)

- WLIST_DTTM (WL Start Date)

- REMVL_DTTM (WL End Date , can be NULL)

The calculation in SQL is as below

DECLARE @EndDate Date = '2012-01-01'

SELECT 
DATEDIFF(DAY,WL.WLIST_DTTM,@EndDate) as 'OnList'
,WL.[WLIST_REFNO]
       ,WL.[WLIST_DTTM]
       ,WL.[REMVL_DTTM]
FROM <Table> WL
WHERE
((WL.REMVL_DTTM IS NULL OR WL.REMVL_DTTM > @EndDate) AND WL.WLIST_DTTM <= @EndDate)  
AND  DATEDIFF(DAY,WL.WLIST_DTTM,@EndDate) > 28

Here, @EndDate is the parameter selected in report. 

I now have to replicate this scenario in SSAS. I am not too sure how to go about solving this.

Since I cannot join the Fact and Date dimension in the cube using either of the date columns, I decided to create a 3rd column called ActivityDate (which consists of all dates from Date Dimension, ) and also restricted data to have REMVL_DTTM only for the year 2012 and above but the record count is massive (about 1 million) and does not seem to be the right approach.

I cant get my head around to apply the above filter condition using CURRENTMEMBER in MDX calculation.

Any help is greatly appreciated.

Please let me know if I need to provide more details.

Thanks in advance.

Bhavana


Viewing all articles
Browse latest Browse all 2472

Trending Articles



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