# Database Discussions > MDX and Analysis Services >  Finding last measure data from time dimension

## WillR

Using AS 2000

We have a fact table with a Building Count measure. The data is uploaded weekly (so there are generally 4 uploads & therefore data sets per month)

Now we are trying to develop reporting to show the total building count at the last dataset fo a given time hierarchy...

So for year it would be the set uploaded closest to 31 dec

For Q1 the closest dataset to 31 Mar
For jan the closest dataset to 31 Jan

You get the picture. We want ONLY the aggregation from the single dataset and NOT the last value that may have occurred in the time period. For example, a property may return a building count of 1 on 6th Jan data upload, however if it returned a null value for the subsequent uploads of 13Jan, 20Jan &27Jan, we need it to show 0 if we are querying January 2007.

Currently we do this via 4 calculated cells in the PropertyCount Cube, to cater for AllTime, Year, Quarter & Month, with a calculation as follows:




> tail(filter([Time].Currentmember.children, NOT ISEMPTY([Measures].currentmember)), 1).item(0)


If we query at the top level of any dimension, the correct building count seems to be returned. If, however we go down towards leaf level at say propertyId, we seem to then include properties that did have a value at some point during the query period, even if they do not have a value at 27Jan uploaded data.

How can we stop this happening & limit the buildingcount to just the set of data uploaded last duering the queried period from the time hierarchy ?? (Using AS2000 remember)

----------

