May 10, 2012 at 10:43 am
Good Day Everyone,
One of my customers came to me with the following request to be dealt with using SSRS: presenting on the same column chart:
a.) aggregated data for the current year, broken down per month
b.) consolidated data for the last four full years.
Here is a representation of the actual goal, created with MS-Excel (cf. image attached)
Has anyone come across such a request? I suspect this would not be achievable as mixing grouped and ungrouped data on the X-axis seems nowhere to be found.
Thank you for your feedbacks folks !
May 10, 2012 at 5:23 pm
You might want to try using a group expression that groups by Month if the Year is current year Else group by Year. Your dataset would have a Month Column and a Year column.
May 10, 2012 at 6:35 pm
im_lanie (5/10/2012)
You might want to try using a group expression that groups by Month if the Year is current year Else group by Year. Your dataset would have a Month Column and a Year column.
Nice! Never thought to do that. Sheesh.
May 11, 2012 at 6:54 am
What an awesome answer, thank you very much ! Here is what a raw attempt looks like following your tip.
May 11, 2012 at 7:09 am
I would probably approach this from the dataset side. I would consolidate my prior years into a single row in the dataset so that you ended up with data something like this, then the graph problem solves itself
TimePeriod, value
2008, 98%
2009, 94%
2010, 92%
2011, 97%
Jan2012, 99%
Feb2012, 97%
Mar2012, 98%
May 11, 2012 at 7:39 am
Thank you for your answer Daniel, this is another suitable answer, even though I personally prefer to deal with 'consistent' datasets.
May 14, 2012 at 2:21 am
donbuz (5/10/2012)
Good Day Everyone,One of my customers came to me with the following request to be dealt with using SSRS: presenting on the same column chart:
a.) aggregated data for the current year, broken down per month
b.) consolidated data for the last four full years.
Here is a representation of the actual goal, created with MS-Excel (cf. image attached)
Has anyone come across such a request? I suspect this would not be achievable as mixing grouped and ungrouped data on the X-axis seems nowhere to be found.
Thank you for your feedbacks folks !
I have done this for a few clients and found (like Daniel) that the best way is to work on the dataset. Main reasons for this rather doing the work in SSRS are performance (SQL tuning for group by etc) and allowing multiple data sources (such as historic and current counts).
The query below is a mock up of the original results required by you, as a dataset in SSRS. I know it could be tidied up but the first set is the yearly values and the second are the monthly values. The OrderGroup and Subgroup are used for sorting on the horizontal axis.
select * from
(
select 1 as OrderGroup, 1 as SubOrderGroup, '2008' as XAxis, 0.95 as Year,NULL as Month,NULL as Target, 'Blue' as BlockColour,'White' as LabelColour
union
select 1 as OrderGroup, 2 as SubOrderGroup, '2009' as XAxis, 0.94 as Year,NULL as Month,NULL as Target, 'Blue' as BlockColour,'White' as LabelColour
union
select 1 as OrderGroup, 3 as SubOrderGroup, '2010' as XAxis, 0.96 as Year,NULL as Month,NULL as Target, 'Blue' as BlockColour,'White' as LabelColour
union
select 1 as OrderGroup, 4 as SubOrderGroup, '2011' as XAxis, 0.99 as Year,NULL as Month,NULL as Target, 'Blue' as BlockColour,'White' as LabelColour
) as YearValues
UNION
select * from
(
select 2 as OrderGroup, 1 as SubOrderGroup, 'Jan' as XAxis, NULL as Year,0.89 as Month,0.95 as Target, 'White' as BlockColour,'Blue' as LabelColour
union
select 2 as OrderGroup, 2 as SubOrderGroup, 'Feb' as XAxis, NULL as Year,0.90 as Month,0.95 as Target, 'White' as BlockColour,'Blue' as LabelColour
union
select 2 as OrderGroup, 3 as SubOrderGroup, 'Mar' as XAxis, NULL as Year,NULL as Month,0.95 as Target, 'White' as BlockColour,'Blue' as LabelColour
union
select 2 as OrderGroup, 4 as SubOrderGroup, 'Apr' as XAxis, NULL as Year,NULL as Month,0.95 as Target, 'White' as BlockColour,'Blue' as LabelColour
union
select 2 as OrderGroup, 5 as SubOrderGroup, 'May' as XAxis, NULL as Year,NULL as Month,0.95 as Target, 'White' as BlockColour,'Blue' as LabelColour
union
select 2 as OrderGroup, 6 as SubOrderGroup, 'June' as XAxis, NULL as Year,NULL as Month,0.95 as Target, 'White' as BlockColour,'Blue' as LabelColour
union
select 2 as OrderGroup, 7 as SubOrderGroup, 'July' as XAxis, NULL as Year,NULL as Month,0.95 as Target, 'White' as BlockColour,'Blue' as LabelColour
) as MonthValues
Order by OrderGroup,SubOrderGroup
The resulting dataset has 3 series (year, month and target). You can easily add more. For the yearly the month and target series are NULL. For the monthly the year series is NULL. The BlockColour and LabelColour are used to allow for presentation control i.e. highlighting best/worst/current month.
To make the columns show as originally required make the Year and Month series as stacked bars (one will hide in all cases) and make the target a line chart. Change the fill of the bars to the BlockColour, and the Label font colour to the LabelColour.
Picture of the resulting chart and the RDL of the demo attached (.txt needs renaming to .rdl).
Fitz
May 22, 2012 at 11:43 am
Mark, thank you for your great post.
Both you and Daniel finally convinced me that the 'dataset' approach is way better adapted for my needs.
Regards,
don
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply