Tuesday, August 23, 2011

TFS Scrum Templates and Burndown Report and Weekends

This applies to Microsoft Visual Studio Scrum 1.0

You may notice that when you run the Burndown report with a scrum runs longer than one week your burn down will look like :

The horizontal line is when the sprint runs over the weekend. This means your ideal trend line is out.
This can be fixed by editing the report, select the following menu :
This will open the report in the editor.
The first thing we will do is remove weekend from the horizontal line. Select Category Group Properties for the Category Groups eg
Select the filter tab and enter the following :
Filter Expression
Type Integer (to the right of the fx button)
Operator <
It will look like :
If we run the report now you will see the weekend have gone but you will have a ‘kink’ in the ideal trend :
The report runs some code called Burndown, to fix this we need to alter the parameters we pass to Code.Burndown .
On the chart data select expression for Work_Item_Count eg
Change this to
=Code.Burndown(Sum(Fields!Remaining_Work.Value), IIF( DateDiff( DateInterval.Day,Parameters!StartDateParam.Value , Fields!DateValue.Value) > 6, DateAdd(DateInterval.Day,-2, Fields!DateValue.Value )  ,Fields!DateValue.Value)  ,  DateAdd(DateInterval.Day,-2, Parameters!EndDateParam.Value )  )
What we have done is subtracted 2 from the end date and we subtract 2 from the Date on this axis if its greater then 6.
I am sure you could just edit this function on the server but the above works.
You report will now look like :


  1. Nice post, one remark: this solution only works for a two-week sprint.

  2. Yep, I agree but you could change it to make it work for how many weeks your sprint runs.

  3. Cheers Steve,

    FYI here's some code to make it work with arbitrary length sprints. I've just created a function which works out how many weekend days have passed and uses that to offset, instead of the hard-coded 2.

    Add this function to the Code for the report:

    ' Define other methods and classes here
    Function NumberOfDaysToAdjustForWeekends(ByVal valNow as Date, ByVal startOfSprint as Date) AS Int32

    Dim valCurrent As Date = startOfSprint
    Dim weekendDaysPassed As Int32 = 0

    Do While valCurrent < valNow

    valCurrent = valCurrent.AddDays(1)
    If (valCurrent.DayOfWeek = DayOfWeek.Saturday Or valCurrent.DayOfWeek = DayOfWeek.Sunday) Then
    weekendDaysPassed = weekendDaysPassed + 1
    End If


    Return weekendDaysPassed

    End Function

    And change the Code.Burndown code to:
    Fields!DateValue.Value.AddDays(-Code.NumberOfDaysToAdjustForWeekends(Fields!DateValue.Value, Parameters!StartDateParam.Value)), Parameters!EndDateParam.Value.AddDays(-Code.NumberOfDaysToAdjustForWeekends(Parameters!EndDateParam.Value, Parameters!StartDateParam.Value)))

  4. Thanks Steve and Graeme. I've made further adjustments to the Sprint Burndown report as using Weekday() function was sensitive to regional settings plus also the Today line was out by number of weekend days passed so I had to adjust the IntervalOffset by NumberOfDaysToAdjustForWeekends from start to Today().

    I've uploaded the complete and working sprint burndown without weekends report below.


    1. This comment has been removed by the author.

    2. The file is missing, would you be able to upload the file again?

    3. Would be nice if Jasmin could upload the file again, i don't understand where to adjust the IntervalOffset...?

    4. could u please upload the .RDL file again?

    5. send me the file to bondre.mayur@gmail.com if possible.

    6. Any chance you can email me the rdl to tchristensen (at) sanjel.com?
      Or anyone else for that matter :)

  5. Just had to apply this same fix in TFS 11 Beta. Graeme's custom function worked beautifully.

  6. Dear Greame, really nice addition, works like a charm.

  7. Hello,
    This is exactly what I need.
    And sorry if this is a newbie question but how do you access the screens you have listed here? I am new to working with TFS bu t would like to get this change in place.

    Thanks for any help you can give.

  8. After a bit of searching I found how to fix the Today stripline hinted at by Jasmin Sehic.

    Click on the Chart Date Axis and open the StripLines property collection. This is the Today line.
    Go to the IntervalOffset property and enter the following code:

    =CountDistinct(Fields!DateValue.Value, "dsBurndown") - DateDiff("d", Today(), Max(Fields!DateValue.Value, "dsBurndown")) - Code.NumberOfDaysToAdjustForWeekends(Today(), Parameters!StartDateParam.Value)

    Getting to the screens listed here is fairly simple:
    Go to the following url on your tfs server: http://ServerName/Reports/Pages/Folder.aspx
    There you can drill down the folder structure until you find the reports you want to edit.
    Open the dropdown of the report and choose "Edit in Report Builder". This will install SQL Server Report Builder using ClickOnce if it was not installed yet.

    To access the code behind of the report, right click outside the white canvas and choose "Report Properties". In the next screen you can see the code tabpage. Just add the NumberOfDaysToAdjustForWeekends method at the bottom.

  9. Bavo, I'm trying to follow your post with minimal BIDS experience... are you able to explain in a little more detail, how to get to the IntervalOffset property, please?

    Do I click on the X-Axis, and select "Horizontal Axis Properties", and then what?

    I appreciate any help you can give.

    Many thanks

    1. Simple search for IntervalOffset in viewcode

  10. excellent post, many thanks! i added some details about how to use the WeekDayName() instead of WeekDay() http://usingscrum.blogspot.com/

  11. Hello

    does any one fix the problem width the "Today line" in the Scrum 2.0 Template

    thank's a lot

  12. I wanted to also not include the weekends in the burndown, however I still wanted to include them in the graph, the following solution will adjust the burndown line to a flat line during the weekends
    To use, just replace the Burndown Function with the following code.

    Function Burndown(ByVal val As Object, ByVal valDate As Date, ByVal endDate As Date)

    If valDate < firstDate Then
    firstValue = Double.NaN
    firstDate = DateTime.MinValue
    End If

    If Double.IsNaN(firstValue) Then
    If Not val Is Nothing And val <> 0 Then
    firstValue = val
    firstDate = valDate
    numDays = WorkDays(valDate, endDate)
    Return firstValue
    End If
    Return (WorkDays(valDate, endDate) / numDays) * firstValue
    End If
    Return Nothing
    End Function

    Function WorkDays(ByVal startDate As Date, ByVal stopDate As Date)
    Dim Current As Date = startDate
    WorkDays = 0
    While (Current < stopDate)
    Select Case Current.DayOfWeek
    Case DayOfWeek.Saturday
    Case DayOfWeek.Sunday
    Case Else
    WorkDays += 1
    End Select
    Current = Current.AddDays(1)
    End While
    End Function

  13. Very nice article. I am a new Project Manager . Your article gave me a good idea of where we need to start improving/changing things.I appreciate the writings.i got my trainnings on scrum fromAgile Certification