MTD, QTD, STD, YTD dynamic measures

I need to create dynamic to-date measures within a universe.

These measures need to be dynamic within the time dimension. The time dimension includes week, month,quarter, season, and year. measures include sales, MTD sales, QTD sales, STD sales… The user needs the ability to create an ad-hoc report with any combination of these objects.

I have been through the threads regarding to-date measures and have tried many of the suggested solutions. Where I’m running into a problem is when multiples of the time dimension objects are used. I can create a measure that will work at the week level and another that will work at the month level, but not a single measure that will handle both. :confused:

I could use aggregate tables at each time dimension level, but creating those tables will add multiple terabytes of data to the warehouse.

The source data is DB2 on Unix.

Any help is appreciated…


lkurriger :us: (BOB member since 2005-09-14)

My guess is that you’ll want to create a FILTER object that is used to determine if you want YTD, QTD or MTD. You can then use a single “measure” object, with your filter to determine which of the aggregation levels to use.

You will have to run mulitple queries to get aggregation at more than one level. A better way to build this (to have all three objects in the same report without requiring multiple runs) is to build three distinct measures using a case statement to determine if the value you are summarizing needs to be included for time frame xxxx.


digpen :us: (BOB member since 2002-08-15)

I think I need to clarify a little (or else I don’t fully understand your reply).

I will have a MTD Sales measure, a YTD sales measure, etc.

I would like to be able to create the following reports with the same measures:

Rpt 1: Week, Month, sales, MTD sales, QTD sales, YTD sales
Rpt 2: Month, sales, QTD sales, YTD sales

Both reports filtered by year.

I can’t seem to figure out a way to create a single MTD Sales measure that will work when summed at the week level and at the month level.

I also forgot that the time dimension is not calendar, it is fiscal, which makes it harder to use a case statement within the select area of the object.

Thanks again…


lkurriger :us: (BOB member since 2005-09-14)

Fiscal or calendar shouldn’t matter, as long as you have a way to convert from one to the other (or use a calendar table which you can join to). If it’s a simple month-shift then you can still handle this in the object builds.

Anyway… you shuold be able to create formulas that generate your values for you (of course you’ll have to shift to deal with fiscal vs. physical calendar dates).

MTD:

sum( CASE WHEN trunc( dateobj, 'MM') = trunc( sysdate, 'MM') then DollarObj else 0 end )

QTD:

sum( CASE WHEN trunc( dateobj, 'Q') = trunc( sysdate, 'Q') then DollarObj else 0 end )

YTD:

sum( CASE WHEN trunc( dateobj, 'YYYY') = trunc( sysdate, 'YYYY') then DollarObj else 0 end )

digpen :us: (BOB member since 2002-08-15)

Can someone help what if I use only FIscal YR and Fiscal Month instead of a Date Field, how can i get the Fiscal YTD calculation?

Your help is appreciated.


BOBUSER :india: (BOB member since 2005-05-23)

We handle it by having a Calendar table, which identifies the fiscal year and so forth for any given date.


Anita Craig :us: (BOB member since 2002-06-17)

Thanks Anita for the reply. But my question here is KEY POINT is I am not using DATE FIELD at all, I am only basing on Fiscal YR and Fiscal Month Fields On the Report I want to prompt Fiscal YR and MOnth and so from that Month in the Fiscal YR to the Start of that Fiscal Yr I need data to be shown on the report.

Say Fiscal yr - user selected = 2006
Fiscal Month - May

I should be able to get the values from July 2005-May 2006

Please advise me.


BOBUSER :india: (BOB member since 2005-05-23)

Assuming you have a fiscal calendar table that defines your fiscal months/year etc., and it is appropriately linked into your fact tables; you could simply add a month rank field to this table that denotes month 1 in your fiscal calendar to month 12. (We’ve ranked months over multiple years, so that you can easily do rolling history 12 month history.) Then convert the users prompted month selection into the month number (or simply have the users select fiscal month #). Your prompts will be: Year equal to “Year Prompt”, and Fiscal Month less than or equal to “Month Prompt”.


Peter Henke (BOB member since 2003-12-02)