Showing posts with label tracking. Show all posts
Showing posts with label tracking. Show all posts

Tuesday, March 20, 2012

create a "virtual dimension" in MDX?

I have a warehouse with bug tracking data in it. Each bug has a priority and a state, among other things. State can be Active Resolved or Closed and Priority can be 1 2 or 3.

I want to use SSRS to display a chart with the following four lines (over time):

active priority 1 bugs active priority 2 bugs active priority 3 bugs resolved bugs (total)

The closest I can get is this (six lines)

active priority 1 bugs active priority 2 bugs active priority 3 bugs resolved priority 1 bugs resolved priority 2 bugs resolved priority 3 bugs

This is becuase if I put priority on the chart's legend, it will slice everything that is in the data area. I get requests such as this one all the time where the customer wants to see data combined into a graph, but may want different slicing semantics for each data series. For example, I may want to put somthing on the graph like Test Results where it doesn't even make sense at all to slice by Priority. It seems like one way to do this would be to create a new dimension on the fly that would crunch some of these down, such that the result set would look like this:

date, legend, bug count

6/1, pri1, 10

6/1, pri2, 45

6/1, pri3, 78

6/1, resolved, 5

6/2, pri1, 11

6/2, pri2, 30

6/2, pri3, 90

6/2, resolved, 3

etc.

Any ideas on how I could do this?

I've pasted the code below. BTW, this is against the TFS warehouse, but like I said, I'm really looking for a solution to the general problem.

thx.

Matt

WITH

MEMBER [Measures].[Date Key] AS

[Date].[Date].CurrentMember.UniqueName

SELECT

{

[Measures].[Date Key],

[Measures].[Cumulative Count],

[Measures].[State Change Count]

} ON COLUMNS,

(

([Date].[Date].&[2007-06-01T00:00:00]:[Date].[Date].&[2007-06-30T00:00:00]),

UNION

(

([Work Item].[System_State].[System_State].[Active],

except([Work Item].[System_Reason].[All].Children, {[Work Item].[System_Reason].&[Build Failure]})),

([Work Item].[System_State].[System_State].[Resolved], [Work Item].[System_Reason].[System_Reason].[Fixed])

),

[Work Item].[Microsoft_VSTS_Common_Priority].[Microsoft_VSTS_Common_Priority],

[Work Item].[Microsoft_VSTS_Common_ActivatedBy]

) ON ROWS

FROM [Team System]

WHERE

(

[Team Project].[Team Project].[ACS],

[Work Item].[System_WorkItemType].[System_WorkItemType].[Bug]

)

The trick is in building the cross-dimension set. The code below shows how you can control the members in a cross join. The sample is based on Adventure Works, but you can imaging the All Customers member is equivalent to your All Severity member.

Good luck,
Bryan

Code Snippet

select

{} on 0,

{

([Product].[Category].[Category].[Bikes]*

[Customer].[Gender].[Gender].Members),

(EXCEPT([Product].[Category].[Category].Members,[Product].[Category].[Category].Bikes)*

[Customer].[Gender].[All Customers])

} on 1

from [Adventure Works]

;

Sunday, February 19, 2012

Counting values for transportation mode

I have a table for tracking transportation mode to work for each pay period. There are five modes

1=Transit
2=carpool
3=bicycle
4=walk
5=vanpool

The pay period database fields are below. A number is entered for each day representing the mode (the field type in the SQL db is char) . I would like my report to count the modes for each pay period.

I have create a group on the field "PayPeriod". It seems that I should be able to create a formula like this for each mode.

Wk_1_Sun
Wk_1_Mon
Wk_1_Tues
Wk_1_Wed
Wk_1_Thurs
Wk_1_Fri
Wk_1_Sat
Wk_2_Sun
Wk_2_Mon
Wk_2_Tues
Wk_2_Wed
Wk_2_Thurs
Wk_2_Fri
Wk_2_Sat

NumberVar tot1sun1 := 0;
NumberVar tot1mon1 := 0;

If ({ECAPParticipate.Wk_1_Sun}= "1") Then
tot1sun1 := count({ECAPParticipate.Wk_1_Sun})
else
If ({ECAPParticipate.Wk_1_Mon}= "1") Then
tot1mon1 := count({ECAPParticipate.Wk_1_Mon})

etc.

I am getting scewed results. I'm new at this so I'm sure that my programming is not correct. Can someone give me some guidance. Thank you.If your report is grouped by the payperiod, then add a summary that counts the modes for each one. Place that summary in your Group header or footer where ever you want it visible.

GJ