SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Retrieving the last non-empty value and display it for each day


Retrieving the last non-empty value and display it for each day

Author
Message
all_vn
all_vn
SSC Rookie
SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)

Group: General Forum Members
Points: 29 Visits: 179
Hi all,

I am new to SSAS and more so with MDX and I need your help with the following scenario please.

In my cube, there is a measure called WIP Hours (Work In Progress Hours).
This measure is from a measure group called WIP, which is based on a fact table, namely facWIP.

facWIP table gets its data from a source table.
Each time a user enters a WIP entry to the front-end system, that entry is stored in this table.
However, users don't always put an entry everyday.

For example, there is an entry for 16 Aug 2013 and the WIP value = 47.
The next entry is on 26 Aug 2013 of WIP = 42
There are no entries for 17 Aug - 25 Aug 2013 in the source table, hence the same in the fact table.

This is reflected in the cube that I build (see screenshot attached).
The requirement is that if there are no entries for a particular date, then need to use / display the last number available.
So in this case, in the cube there should be entries for 17 - 25 August with WIP = 47, etc.

I have no idea how to do this, if it is possible at all.
I tried using the following MDX

CREATE MEMBER CURRENTCUBE.[Measures].[WIP Hours_2]
AS
(TAIL(NONEMPTY(DESCENDANTS([Calendar].[Calendar].CURRENTMEMBER,[Calendar].[Calendar].[Calendar Date]), [Measures].[WIP Hours]),1).ITEM(0), [Measures].[WIP Hours]),
//NON_EMPTY_BEHAVIOR = { [Measures].[WIP Hours] },
VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'WIP' ;

but it doesn't do what I want.

Any assistance are very much appreciated.

Thanks!
Attachments
WIP_Cube.PNG (10 views, 128.00 KB)
something_123
something_123
SSC Rookie
SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)

Group: General Forum Members
Points: 25 Visits: 256
Sounds like you need to be loading this cube from an periodic snapshot fact table that holds a record for each day.

Or, when querying the cube you simulate a left join:
[url=http://bifuture.blogspot.com.au/2011/06/ssas-non-empty-and-innerleft-outer.html][/url]
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search