How to create a Gantt Chart or Progress bar inside a Table in SSRS | CloudFronts

How to create a Gantt Chart or Progress bar inside a Table in SSRS

In this article, we will create a Gantt Chart or Progress bar inside a table in SSRS .

In SQL Server Reporting Service does not allow a report programmer to modify a “width” property at run time. The challenging part of this task is how to create a scale and how to create a progress bar that spans a start date and end date. But SSRS have a range bar chart that will help you to make a Gantt chart or progress bar. And display diamond shape if start date and end date is same.

For creating Gantt chart, we need a Data source, a Dataset, a Table and a Range Bar chart.

Steps

Step 1: First create a new data source.

Step 2:  Before creating a data set, we need to write a Fetch XML query that created the data we’re going to work with.

Fetch XML Query:

<fetch version=”1.0″ output-format=”xml-platform” mapping=”logical” distinct=”false”>

<entity name=”milestone”>

<attribute name=”createdon” />

<attribute name=”item” />

<attribute name=”projectid” />

<attribute name=”contractorid” />

<attribute name=”packageid” />

<attribute name=”startdatemilestone” />

<attribute name=”remarks” />

<attribute name=”finishdatemilestone” />

<attribute name=”startdateforecast” />

<attribute name=”finishdateforecast” />

<attribute name=”startdateactual” />

<attribute name=”finishdateactual” />

<attribute name=”progress” />

<attribute name=”status” />

<attribute name=”durationdays” />

<attribute name=”sequencenumber” />

<attribute name=”milestoneid” />

<order attribute=”item” descending=”false” />

<filter type=”and”>

<condition attribute=”projectid” operator=”eq” uiname=”ABC” uitype=”pmtracker” value=”{86AF05D9-6962-E911-A834-000D3A07F3D7}” />

</filter>

</entity>

</fetch>

This gives us a result set like this :

Sequence NumberItemPackageStart Date(Milestone)Finish Date(Milestone)Start Date(Forecast)Finish Date(Forecast)Start Date(Actual)Finish Date(Actual)Duration(Days)Status
1Concept DesignLighting02-01-201906-02-201903-01-201909-02-201903-01-201909-02-201937.00Completed
2Concept Design approvalLighting13-02-201913-02-201907-02-201914-02-201907-02-201913-02-20196.00Completed
3Detail DesignLighting14-02-201917-04-201914-02-201917-02-201914-02-201918-02-20194.00Completed
4Detail Design ApprovalLighting17-04-201923-04-201917-04-201924-04-201917-04-201922-04-2019Delay
5Tender IssueLighting29-05-201931-05-201901-06-201903-06-201901-06-201903-06-2019Delay
6Tender ReturnLighting31-05-201922-06-201903-06-201903-06-201903-06-201924-06-201921.00Completed

Step 3: Now we create a Data set from this query:

If start date and end date is same then need to display diamond shape, for that we have to add three calculated field.

Need to find number of days between two dates.

DayDiff_MileStone=DateDiff(“d”,Fields!startdatemilestoneValue.Value,Fields!finishdatemilestoneValue.Value)

we are going to set the following properties:

We’re going to create a table within the report that has a column for each of the columns in the data set, plus a column for a graph.

We just have to bind the Table to the data set “MilstoneData”

Then drag the columns of the data set to the columns of the table.

Step 4 : Build the Gantt Chart

SSRS have the Range Bar Chart option.

Just drop the chart onto a blank area of the report. We’ll fit it into table later.

Now we are going to take fewer part of the chart. We’re throw away of:

  • The chart title
  • The legend
  • The vertical Axis title
  • The vertical axis
  • The horizontal axis title

When we’re done, the chart should look like this:

Let’s start setting up the chart.

The first thing we need to do is set the Minimums, Maximums, Intervals and Interval Types.

The client wants minimum date must be from “startdatemilestone” date and maximum date should be “finishdateforecast” date.

On the Horizontal Axis, we are going to set the following properties:

Minimum=DateSerial(Year(Min(Fields!startdatemilestoneValue.Value, “MilestoneData”)), Month(Min(Fields!startdatemilestoneValue.Value, “MilestoneData”)), -1)
Maximum=DateSerial(Year(Max(Fields!finishdateforecastValue.Value, “MilestoneData”)), Month(Max(Fields!finishdateforecastValue.Value, “MilestoneData”)) , 0)
Interval1
Interval TypeMonths

Also going to set the format the of items along the Horizontal Axis to MM-yyyy

Go to chart series properties, set Marker properties.

Let’s get a preview of the report and see how we’re doing.

It’s correct, but it doesn’t provide the milestone data. Now cut the chart and paste it into the details row of the Table, in the right most column. Now we’re going to run a preview.

OOPS!

We receive the error “The chart has a detail member with inner members. Detail members can only contain static members.

What this means is that chart cannot live in a detail row.

We’re going to create a Group that contains only a single Item.

After selecting the Table, at the bottom left of the screen, we find “Row Groups”,

Just click on preview shows us:

Nice-looking but do we really need a timeline on every now?

Now we are going to need a timeline. So, let’s take a copy of the Chart and put it right next to the header “Duration”

Now we can hide the Axis Labels on the chart in the footer. We can also change the Axis line style to none.

Click on preview

Wow! Hope this helps you!

Check out my other blog here https://www.cloudfronts.com/performing-update-operation-in-microsoft-dynamics-nav-through-integration-in-scribe-online/


Share Story :

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close