Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Retrieving the last non-empty value and display it for each day Expand / Collapse
Author
Message
Posted Wednesday, September 4, 2013 11:50 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, July 25, 2014 7:18 AM
Points: 6, Visits: 66
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!


  Post Attachments 
WIP_Cube.PNG (2 views, 128.84 KB)
Post #1491627
Posted Sunday, September 8, 2013 9:19 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, July 15, 2014 6:05 PM
Points: 6, Visits: 211
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]
Post #1492650
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse