SSRS bar char x-axis formatting - reporting-services

I've got a chart that overlays the past 2 years (taken from the current date) worth of data onto a 1 year range, so the monthly values can be compared between years. The x-axis values are week numbers.
Currently, I've got the x-axis like this:
-------------------- etc
1 2 3 4 5
What I want is to start the x-axis with the week for the earliest date in my data set, so my x-axis looks like this:
--------------------------...-------
49 50 51 52 1 2 3 ... 47 48
How do I get the chart control to get my x-axis to appear like this?

You need to have another column that contains the year, sort by this first, then the week number, then only display the week number in the axis.
So assuming your data is something like:
You would apply two sorts to the category group, Year then Week, but only display Week in the axis label.
I have left all the Category Axis Properties as default:
This gives the expected result:

Related

SSRS bar chart with multiple categories

I have built some quite ssrs charts, but is it possible to create below bar chart n SSRS.
![click on the link below to show the bar chart][1]
but when am creating this in ssrs , am getting report as below.
I am getting the report in ssrs as below, but not like the above one:
![][2]
If you want to include the heading as they are in your first image, you will need to be clever with your dataset.
Personally I would probably take the approach of including dummy chart values to get your Category heading without a corresponding bar in the chart, such as:
Group Order Category Value
31 to 60 Days 1 31 to 60 Days 0
31 to 60 Days 2 Today 14
31 to 60 Days 3 1 Month Ago 12
31 to 60 Days 4 2 Month Ago 44
Up to 30 Days 1 Up to 30 Days 0
Up to 30 Days 2 Today 11
Up to 30 Days 3 1 Month Ago 8
Up to 30 Days 4 2 Month Ago 21
From which you can:
Group your Categories using the Group value
Display each Category in its correct order by sorting on the Order column
Actually display your chart values using the Value column, which will show nothing for your group headings
How you get your data into that format will depend on your data source, but should be fairly trivial if you are using a SQL source.

conditional formatting by date

I have the following table in my report
Address SeenDate
stack street 2015-01-02
over lane 2016-03-15
flow way 2017-05-12
I would like to highlight addresses in green that have got a 'SeenDate' within 12 months, I think this will need to be a rolling 12 months. So from the table above 'flow way' will be highlighted in green.
To do a conditional on your date value to highlight records that are within 12 months of the report execution date, you can compare the date value with a year ago from today using iif in the Fill expression of the textbox:
=iif(Fields!SeenDate.Value >= Today().AddYears(-1), "Green", "Red")
Also a note to add that Today gives you the date for today and Now gives you the date and time of right now, depending on how precise you want to be.

Graph in SSRS only shows a couple of week's data

I'm making a graph in SSRS which will highlight the sales for each week from a specific week, and from 52 week up to that date.
For this I have created the following data set in SSRS:
WITH SET LAST52WEEKS AS
{
STRTOMEMBER("[Dim Date].[Week].&[2017]&[1]&[1]&[4]").Lag(52):
STRTOMEMBER("[Dim Date].[Week].&[2017]&[1]&[1]&[4]")
}
Select {[Measures].[Quantity]} ON 0,
{Last52Weeks} ON 1
FROM (
Select {
[Dim Store2].[Store Key].&[1024]
} on columns
from [DSV_FactStoreSales 1]
)
which works as intended, and have an output for week 13 through 4 with each week having a weekly sales Quantity>400 (except for one week with Quantity (null).
However, when I add this data as the Y-axis in a graph in SSRS along with Weeks attribute as the X-axis, only four rows are returned. The rows returned are for the weeks
1,19,3,40
All other values are blank in the graph. Does anyone have any idea as to why this may occur?
Regards,
Cenderze
EDIT updated x-axis from using Interval value = 1
When I changed the Interval value under Horizontal Axis Properties I now get the following values for the x-axis:
1, 13, 14,[...],19, 2, 20, 21, 22, 23, [...], 29, 3, 30, 31, 32,[...],39, 4, 41, 42,[...], 53
where I have bolded the results which seem odd. Im guessing these values are the quarters? I am however using Weeks as my Grouping variable.
EDIT
Following Mike Honey I figured that:
WITH SET LAST52WEEKS AS
{STRTOMEMBER("[Dim Date].[Date].&[1]&[2017-01-29]").Parent.Lag(52)
:
STRTOMEMBER("[Dim Date].[Date].&[1]&[2017-01-29]").parent}
Select {[Measures].[Quantity]} ON 0,
{Last52Weeks} ON 1
FROM (
Select {
[Dim Store2].[Store Key].&[1024]
} on columns
from [DSV_FactStoreSales 1])
ought to work, but it simply returned that Quantity was (null). Why isn't this equivalent to the other Query I wrote, but based off of Date rather than week?
EDIT
I also noted that the graph I am creating has week 52 to the utmost right, whereas it is supposed to have week 4 at the utmost right.
EDIT
EDIT
Edited the Query to become:
WITH SET LAST52WEEKS AS
{STRTOMEMBER("[Dim Date].[Hierarchy].&[2017 W4]").Lag(52):STRTOMEMBER("[Dim Date].[Hierarchy].&[2017 W4]")}
Select {[Measures].[Quantity]} ON 0,
{(Last52Weeks,[Dim Store2].[Store Name].Allmembers)} ON 1
from [DSV_FactStoreSales 1]
where Hierarchy is an Attribute Hierarchy with the values 2010 W1,...., 2018 W52.
But this yields me an output:
2016 W40 Store1 300
2016 W40 Store2 400
...
2017 W39 Store1 400
where I would expect the output to be:
2016 W4 Store1 300
2016 W4 Store2 400
...
2017 W4 Store1 400
Any ideas? It is just an hierarchy with one attribute, Week Name (I've tried the Query with both using [Dim Date].[Hierarchy].[Week Name].&[2017 W4] and [Dim date].[Hierarchy].&[2017 W4], both with the same output.
EDIT (very close now!)
There are two issues I can see with your current chart. One is that your week numbers are being treated as text, which is why the ordering has sequences like 19, 2, 20. The other is that it isn't distinguishing where the week numbers for one year ends and another year starts.
I'm not familiar with mdx. I'm hoping you're able to make a simple dataset that is purely a list of sales with dates. For my solution, I used an Oracle query like:
SELECT date SALEDATE, ID FROM sales
WHERE date BETWEEN '28-MAR-2016' AND '28-JAN-2017'
With a new chart, use [Count(ID)] for the values. It then needs two category groups, first one for the year and then one for the week number. You can use expressions to get these from a date field. For the first category group, set Group on: and Label as
=DatePart(DateInterval.Year, Fields!SALEDATE.Value)
and for the second, set Group on: and Label as
=DatePart(DateInterval.WeekOfYear, Fields!SALEDATE.Value)
To then hide the columns with under 400 sales, right-click the second category group (the weeks one) and add a filter: [Count(ID)] (integer) > 400.
Even if your dataset is different from the raw data approach I'm using, hopefully this will steer you in the right direction.
Right click on the x-axis and choose "Horizontal Axis Properties". Under Axis Options change the Interval value from Auto to 1.

SSRS 2012 - Range Chart: How to Change Month Interval to Quarter and Grouping Vertical axis?

I am developing SSRS range chart report in 2012 by following http://pnarayanaswamy.blogspot.in/2012/12/ssrs-2008-r2-range-bar-chart-gantt.html link, Now I have a problem with month headers and grouping range chart.
I am giving Label Intervaltype = months and Label Interval = 3 and LabelFormat = "MMM". It is showing month name for each 3 months. I want to convert it to corresponding months quarter format.Like it has to show Q1 Q2 Q3 for each year.
My left side range chart repeating the group names for each row of projects. I want to truncate the group by only one name for each group. When I tried with group category by Project_Group, the adjustment between group chart and details chart are not matching. For example, "Control Level group needs to be displayed only once instead of 3 times, meanwhile all 3 projects remains same in details chart, and the spaces needs to be remain same till next level"
Below is my table structure,
Project ----------- Project_Group
MAC ----------- Backbone
FT -----------Building
MA -----------Control Level
MACH----------- Control Level
MIC -----------Control Level
EE -----------Embedded
EC -----------Embedded
Emb -----------Embedded
I have resolved the grouping issue by using Series Groups and writing expression in series label properties "=IIF(Previous(Fields!Project_Group.Value) = Fields!Project_Group.Value,"",Fields!Project_Group.Value)"...
Can anybody help me to show the quarter in x axis from month?

Show month names against Numeric Values

I have a dataset which looks like this
ProjectName MonthsThisYear CompletionDate
ProjectA 5 5/1/2013
ProjectB 7 7/15/2013
ProjectC 10 10/21/2013
I want to bar plot a graph where Y axis is project Name and X axis is January 2013, February 2013 ... December 2013.
Now the bar against projectA must be 5 units long, ProjectB is 7 units long and the bar for Project C should be 10 units long.
so that people can see that ProjectA is completed in May, ProjectB is completed in July and project C in October.
How can I plot this graph?
currently I can plot this correctly... but the X-Asix has 0, 2, 4, 6, 8, 10, 12 on it rather than month names.
I am on SSRS 2008 R2.
This is what I see right now
I just want to see month names and year on X axis.
Maybe some more question detail would be useful, but here's one way that works with your data:
The main issue we're facing is that typically a date is the category, but in this case it's actually the Data value, which gives us less control over the labels compared to a category group.
First, set up a chart with a Category Group based on ProjectName, and a Data expression like:
=DateSerial(Year(Fields!CompletionDate.Value), Month(Fields!CompletionDate.Value), 1)
i.e. the first of the month of each CompletionDate value, otherwise your bars will be between months.
Next, we need to sort out the X axis:
In my example I set Minimum to:
=DateAdd(DateInterval.Month
, -1
, DateSerial(Year(Min(Fields!CompletionDate.Value)), 1, 1))
i.e. December for the last year. Set Maximum to:
=DateSerial(Year(Max(Fields!CompletionDate.Value)), 12, 31)
i.e. the end of the year.
Set Interval to 1 and Interval Type to Months.
Format the X Axis to MMM yyyy.
Looks OK:
If you can actually add a Year column with a value 2013 or whatever, pretty much all of the expressions above can be simplified. For example, I've ignored MonthsThisYear, but if you have a Year column you can build the start of the month value based on MonthsThisYear and Year.