Skip to Content
0
Former Member
Oct 20, 2005 at 01:49 PM

Can anyone solve this query requirement

27 Views

Would like to know if anyone solved this situation in the query before. If yes, or If you have any ideas, could you please share it with me.

Below is the scenario.

Cube data: We have a number of 'FACILIIES'. 'Surveys' are conducted for each facility once in every six to 18 months. No fixed time intervals though. And surveys are numbered sequencially, always in the increasing order with respect to time. each survey has a 'survey date'. and a keyfigure 'Count'.

DATA IN THE CUBE AS OF 4/30/2005

FACILITY...SURVEYID...SURVEYDATE...COUNTKEYFIGURE

525... 121... 1/6/2004... 6

624... 132... 2/20/2004... 7

525... 138... 10/1/2004... 5

624... 140... 9/15/2004... 4

525... 157... 3/10/2005... 8

624... 245... 4/15/2005... 6

If the query is run for the above data, is shouls be displayed like this.

REPORT AS OF 04/30/2005

FACILITY...LATESTSURVEY...LATESTCOUNT...PREVIOUSSURVEY PRECOUNT

525... 157... 8... 138... 5

624... 245... 6... 140... 4

Once the data is updated further, this is the data in the Cube as of 10/30/2005

DATA IN THE CUBE AS OF 10/30/2005

FACILITY...SURVEYID...SURVEYDATE...COUNTKEYFIGURE

525... 121... 1/6/2004... 6

624... 132... 2/20/2004... 7

525... 138... 10/1/2004... 5

624... 140... 9/15/2004... 4

525... 157... 3/10/2005... 8

624... 245... 4/15/2005... 6

525... 290... 8/20/2005... 9

624... 312... 10/15/2005... 4

REPORT AS OF 04/30/2005

FACILITY LATESTSUREY LATESTCOUNT PREVIOUSSURVEY PRECOUNT

525... 290... 9... 157... 8

624... 312... 4... 245... 6

Dynamically, the latest survey and previous survey has to be determined. Any ideas on how to solve... We alrady thought of making changes to the Survey Master data. Any thing that can be done in the query itself?

thanks

Gova

(I could not improve the display format, so I used '...' to separate the fields. may be SDN should look into improving the display format)