Dear folks,
I'm working on designing a cube solution, where we have multiple versions of lines in a fact table for a particular trade. For aggregation, we need to consider only the maximum version of line for the selected period. I'd like to know your point of view and suggestions for optimal design.
To understand the problem more clearly, consider a fact table as shown below, where for a particular trade we have multiple versions, e.g. TradeId = 1 has versions 1, 2....5 and TradeId = 2 has versions 1, 2 & 3. Let's assume we have dimension tables e.g. for Trade, Products and Date. Amount is a measure which we need to analyse & Version column tells about the version of the trade.
DateId | TradId | ProdId | Amount | Version |
20120101 | 1 | 11 | 100 | 1 |
20120102 | 1 | 11 | 200 | 2 |
20120103 | 1 | 11 | 300 | 3 |
20120201 | 1 | 11 | 400 | 4 |
20120201 | 1 | 11 | 500 | 5 |
20120105 | 2 | 22 | 1000 | 1 |
20120106 | 2 | 22 | 2000 | 2 |
20120107 | 2 | 22 | 3000 | 3 |
As you can see there are multiple versions of a trade record but in our analysis we need to consider the latest ones i.e. having max(version number) for each trade. So if we select date as2012/01/01, we should see Amount as "100" as for that period max version is "1" and there is only one trade "1". If we select month as Feb/2012 in the date hierarchy, we should see Amount as "3500" because we have Trade 1 with max version as 5 and amount = 500 and Trade 2 with max version as 3 and amount = 3000 for the month of Feb/2012, hence aggregated amount would be 3500, likewise at 2012 year level we shall see the same value of amount i.e. 3500.
Similarly, if we select Jan/2012, we should see aggregated value of amount as "3300".
Hope, I've made the requirements clear. In short, we need to consider the latest version of trade, the maximum version shall change dynamically based on the selected period so we don't have an option to make it static at ETL layer based on max version.
Is there a good way to deal this scenario in OLAP? If there are limitations at the OLAP level, any thoughts on having design consideration at ETL layer? I think this would be a common scenario for financial cube so would like to know your valuable thoughts please...?
Thanks,
Santosh
http://microsoftbizintel.wordpress.com/