Alright, this is kind of a convoluted problem, so bear with me:
I have a chart that displays 25 hours worth of data from rows sent to it. The hours of the data are to be displayed starting and ending with the 22nd hour. That is, the x axis goes 22, 23, 0, 1, 2, ... 22. It's important to note that there are two 22nd hours on two separate days.
Now, it is possible that the database will not return some rows. In which case, there must be an empty space for that hour. However, there must still be 25 x axis values.
This combination of restrictions has me stumped. I can't represent the x axis as a custom scalar, because the values are to be displayed out of order and duplicated. And I can't find a way to use an x axis category because I won't get all of the categories from the data and, again, there is a duplicated 22nd hour.
Any help is appreciated, let me know if I can provide any additional information.
I would add a column to the dataset to calculate a "relative hour". This would start with a value of 0 for the 22nd hour, 1 for the 23rd etc finishing with 25 for the 2nd 22nd hour.
Then I would change the Category Group definition in the Chart to use that "relative hour" value as the "Group On" value. Note the Label can remain as is.
I would change the source dataset so that it always returns a row for all the 25 x axis values, e.g. via a right join to a numbers table. Rows representing those "missing" hours will need both the "relative hour" value and your existing hour column value for the label.
Related
I'm stuck with a problem in SSRS 2012 that maybe is very simple:
I have a matrix with a group row (employee) and a group column (last 12 months); the values are COUNT(practicesDone) - i.e. the amount of practices worked.
I want the matrix to show an extra column on the right (after all the columns of the months, and clearly outside the column group) with again the number of practices for the current month.
Is it possible to achieve that?
thank you in advance!
You can do this, it's pretty simple.
I have assumed that your dataset contains a column that has a date for each entry and that the data returned only covers 12 months so the same month would not appear for different years. If your data does have multiple years, look at the second expression below.
Right-click your month column and then to "Insert Column --> Outside Group - Right"
Now set the expression for the text box to
=COUNT(IIF(MONTH(Fields!myDateColumn.Value) = MONTH(TODAY()), 1, Nothing))
You could swap COUNT for SUM and it should do the same thing but either will work.
All we are doing here is comparing the all data in scope which, due to the placement of the text box means the scope is the entire rowgroup. Then for all that data, check if the month matches the current month, if it does set it to 1 is not set it to nothing then count/sum all results. Count conveniently ignores 'nothing'.
If you data covers more than 12 months then you can still do this but you'll have to add a bit more to handle years and months like this.
=COUNT(
IIF(
MONTH(Fields!myDateColumn.Value) = MONTH(TODAY())
AND YEAR(Fields!myDateColumn.Value) = YEAR(TODAY()),
1,
Nothing
)
)
First post in stackoverflow - so forgive me if I don't get this right. I have an SSRS report with a matrix which groups Quantity, Total Spend and Average Cost by part number for each year. Part Number and description down the left and the the years along the top. I want to add a delta column in each year after the first year which shows the change in price from the previous year. I have seen examples of how to get the difference between first and last year - but not the difference between each year and the previous one. I have hidden the delta column for the first year - no would love some guidance on how to calculate the difference in cost.
So from the image below the first row in the delta column under FY2019 would show -€0.01 as price has reduced from 0.59 to 0.58.
You haven't explained how if Avg. Cost is calculated in your report but I'm assumming it's just something like =SUM(Fields!Spend.Value) / SUM(Fields!Qty.Value)
You've not shown your report design so I can't tell what your row/column groups are called but I'll assume you have rowgroup by Part and one by Year. Let's assume your column group name is PeriodID so it's the same as my demo report.
In this case you can use the PREVIOUS() function to get the previous values to compare against.
I set up a similar report to demonstrate. As you can see in my case the year column is grouped using a columngroup called PeriodID
The expressions highlighted are as follows.
Price. This is just Cost/Qty =SUM(Fields!Cost.Value)/SUM(Fields!Qty.Value)
lastprice. This is just for illustration and debugging. It uses the PREVIOUS() fucntion to get the previous year's data
=Previous(Sum(Fields!Cost.Value), "PeriodID") / Previous(Sum(Fields!Qty.Value), "PeriodID")
Note that "PeriodID" is the name of the column group (case sensitive). This is scope for the previous function so it know to get data from the previous column group.
delta. This is the final output. It's just the current "Price" expression minus the "lastprice" expression.
=(Sum(Fields!Cost.Value) / Sum(Fields!Qty.Value)) - (Previous(Sum(Fields!Cost.Value), "PeriodID") / Previous(Sum(Fields!Qty.Value), "PeriodID"))
The final output looks like this (I've not hidden the column for the first column group or hidden last price, just so you can see it working). Also, if you see slight differences in the delta column compared to what you might expect, it's just down to the fact that the numbers are formatted to 2 decimals but my test data is up to 14 decimals.
I'm working on WebI 4.2 Support Pack 4 Compilation : 14.2.4.2410. I have an array with the number of days to make an action. For example 967 times an action was make in 0 day.
I only want to display lines with 0,1,2,3,7 (one week),14 (two week),21,30 (one month),90 (three month) and more than 90 days cause it will be more relevant for my report. I tried to make a Running Sum on my number of days to get my total of action and then a percentage but it failed.
My formula only takes values of the displayed days skipping others. I use this formula to get my interesting days :
=[number_day] Where([number_day]In(0;1;2;3;7;14;21;30;90))
I don't understand why I have an empty frame after '90', i tried to insert the max value of "Number of day" after but that failed too.
Finally how can I get =0+1+2+3+4+5+6+7 in front of '7' instead of =0+1+2+3+7 here is the formula i used : =RunningSum([total_action])
I do not quite understand why you want to do this in the manner you have stated. Or maybe I am just not understanding it correctly.
It seems to me you need to create a variable to group your day numbers. Something like this...
DayNumberGroup=If([number_day] InList(0; 1; 2; 3; 7); "One Week";
If([number_day] InList(14); "Two Week";
If([number_day] InList(21; 30); "One Month";
If([number_day] InList(90); "Three Month";
"Three Month+"))))
Then your running sum variable should look like this...
DayRunningSum=RunningSum([Action Sum]; ([DayNumberGroup]))
Having DayNumberGroup as the second parameter for the RunningSum() function causes the sum to restart on a change in the value of DayNumberGroup.
I am not sure why you are excluding the values of 5, 6, 8, etc., but in order for them to not be lumped into "Three Month+" you are going to have to add a filter to your table to exclude them.
Hope this gets you on the right track.
Take Datetime and give the half hour band it belongs to, irrespective of the date, just interested in the time.
There is as far as I can see, no time periods in SSRS, I need half hour time periods, that's 48 blocks in a day.
I would like to plot my data in bar chart,the interval for the bar width is along the x axis, the height is the occurrences on the y axis. I need an interval of half hour(the width of the histogram),I don't want to run some IIF/CASE statement, I would rather, convert the DateTime i have to a band on each row of data, what's the best way to output so I get half hour intervals along the X axis.
I don't want to run some IIF/CASE statement
By this I assume you mean you don't want 48 layers of IIF/CASE. Here's an SSRS expression that'll band a datetime just using a single IIF:
=DateAdd(DateInterval.Minute, 0-
IIF(Minute(Fields!DATETIMEFIELD.Value) <= 29, Minute(Fields!DATETIMEFIELD.Value), Minute(Fields!DATETIMEFIELD.Value) -30),
DateAdd(DateInterval.Second, 0-Second(Fields!DATETIMEFIELD.Value) ,Fields!DATETIMEFIELD.Value))
This removes the seconds from the time, and removes as many minutes necessary to get to the previous half-hour. You could likely use the same logic with different syntax as a column in your SQL query, if you prefer.
Use this calculated value for all the relevant parts of your SSRS chart.
Could please help me how to go about a Column(Vertical) Chart doing the following:
x-axis = Count of orders.
y-axis = Months
series = OrderType.
So basically I see the following info on the chart:
Jan 2000 I see OrderType (i) has 3 Orders, (m) has 9 orders, (l) has 6.
So this I can probably figure out, the difficult part I want to know which I have no Idea how to do is:
I want a dropdown to change the y-axis view.
The dropdown would contain : Week, Month, Year, Day.
When selecting "Week" for example, the y-axis should render,calculate and display the y-axis according to week
Much like a calendar works. I am not even sure if this is possible?
I do not think this is possible. I would suggest that you have two overviews instead, one for the yearly view and one for the monthly-year break down.
FYI, I think X- axis should be the Month/Year. And Y axis should be the amounts and series can be the order types.