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

  • 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!

  • 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:

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply