Re: CubeMeisters please help.
- From: "Myles.Matheson@xxxxxxxxx" <Myles.Matheson@xxxxxxxxx>
- Date: 5 Jun 2005 23:38:28 -0700
Hello Bob,
I will try and help. It's a bit hard to see the problem without more
complete sample data. From what you have posted I think you have the
following issue.
For any given batch you have a number of failures and an overall batch
size. You would like to measure the number of batch fail types vs. the
total batch size.
Batch Failure Type
1 Fail Type A
1 Fail Type B
1 Fail Type B
1 Success
2 Fail Type B
2 Fail Type B
2 Success
The main issue is Batch size is at a different grain to the Failure
types.
One solution is to create an aggregated count at Failure type this
would allow you to compare the types of failure against the total Batch
(is this what you are after?).
Once you have the counts by batch type you are able to create the
following sample set of data.
Eg.
Batch Fail Type A Fail Type B Success Batch Size
1 1 2 1 4
2 0 2 1 3
>>From this you would be able to calculate the percentage of failure
types against a total batch size in a cube or report.
This would best be done in a fact table of course. You can still have
the following dims at this level. Batch Size (a band dimension), Time,
location, etc.
A band dimension is a range dim allowing you to group up batches into
sizes.
To create this you would need a count for each batch type say using a
UNION Statement with a group by to bring the results to the batch size
level. Have a look at my Hackie Hack code below.
Eg.
SELECT
FB.Batch
, SUM(FB.FailTypeA) AS FailTypeA
, SUM(FB.FailTypeB) AS FailTypeB
, SUM(FB.Success) AS Success
, SUM (FB.BatchSize) AS BatchSize
FROM
(
SELECT
Batch
, Count(*) AS FailTypeA
, 0 AS FailTypeB
, 0 AS Success
, 0 AS BatchSize
FROM BatchLog
WHERE BatchType = 'Fail Type A'
UNION ALL
SELECT
Batch
, 0 AS FailTypeA
, Count(*) AS FailTypeB
, 0 AS Success
, 0 AS BatchSize
FROM BatchLog
WHERE BatchType = 'Fail Type B'
UNION ALL
SELECT
Batch
, 0 AS FailTypeA
, 0 AS FailTypeB
, Count(*) AS Success
, 0 AS BatchSize
FROM BatchLog
WHERE BatchType = 'Success'
UNION ALL
SELECT
Batch
, 0 AS FailTypeA
, 0 AS FailTypeB
, 0 AS Success
, Count(*) AS BatchSize
FROM BatchLog ) AS FB
GROUP BY FB.Batch
I hope this helps if not, I would try and re-post this to the OLAP news
group.
Myles Matheson
Data Warehouse Architect
.
- Follow-Ups:
- Re: CubeMeisters please help.
- From: Bob
- Re: CubeMeisters please help.
- References:
- CubeMeisters please help.
- From: Bob
- CubeMeisters please help.
- Prev by Date: CubeMeisters please help.
- Next by Date: Can I pick your brains for a second? transferring a large database problem.
- Previous by thread: CubeMeisters please help.
- Next by thread: Re: CubeMeisters please help.
- Index(es):
Relevant Pages
|
Loading