I have the following requirement for a report.
I have a repeating bar chart within a Tablix region (grouped by individal). On that chart, I need to display the percentage of a value (call it sales) for each month. So a chart will have a single employee, with a bar for each month, showing the month total sales as a percentage of the grand total sales. That's the easy part: my expression shows (=Sum(Fields!Sales.Value) / Sum(Fields!Sales.Value, "EmployeeChart").
My next requirement is what has me stumped. I need to display the average Sales Percentage value for each employee as a line (or bar) next to the individual Sales Percentage value. So for each month, I need to know how the Percentage distribution compares to the group average Percentage.
The end result has one graph repeated for each employee, with a bar series showing the percentage of sales in each month, and a line series (which has the same values in each chart) showing the average sales percentage of that month for all employees.
I've tried the following, and haven't gotten the results I want.
=Avg(Sum(Fields!Sales.Value) / Sum(Fields!Sales.Value, "EmployeeChart"), "EmployeeTablix")
I've also tried various combinations of declaring scopes, none of which worked - I can't get it to give me the average of multiple group separations (e.g., SalesMonth and EmployeeTablix) .
Any suggestions?
Why don't you divide the grand total by total number of months in your chart for a line chart type?
=Sum(Fields!Sales.Value, "EmployeeChart") / CountDistinct(Fields!Month.Value)
... or similar for your dataset.
Shew this one is a bit old but I came across it when looking for solution to a related problem I am having with averages shown on a chart. I thought I can share what I have done as it might be a solution?
I am working on something similar in SSRS. I have a chart giving total volumes per day of three items for a week.
On the label of each day I have added (Appended) a total of all items on that day. And under the series (Showing the colours for each item) I have added an average for the week for each item.
Here's an example..
(My averages are a bit off with only the last average being correct.)
To append this information to the labels of category or series groups in SSRS you need to do the following:
Click on the series group you want to edit of the chart. This will display a little "Chart Data" window listing "Values," "Category Groups" and "Series Groups".
Right-click on the item under either Category or Series group that you want to work with and click on "Properties".
Click on the fx button next to the "Label" field to open the Expression editor.
Add the information you want to display separated by "&". For example: =Fields!Day.Value & "(Tot.: " & SUM(Fields!Matters.Value) & ")"
This example will display the Name of the day with the text " (Tot.: ", the totals for all items on that day and ended off with ")". As in "Mon (Tot.: 486)".
If you want to list the appended information below the label, then you must add vbcrlf between some &'s.
Related
I am very new to Access. I am trying to learn on my own through videos but have been somewhat thrown in on the deep end.
I have a table full of reports of individually inspected boxes of items. Every entry has a date, inspector number, and number of items inspected. Am I able to create an MS-Access query that reports the number of boxes inspected by an individual inspector (by inspector number) for each week, I picture each column being the sum of number of boxes for each row (inspector).
As of right now I have gotten a query that gives number of boxes per inspector, per month across the span of all time. So column one, for example, is summarizing the number of boxes an inspector has done every January since the beginning of the report rather than an individual January (or what I really need, an individual week).
Is this something that can be done in Access or am I overextending its usage (or perhaps misusing it all together)?
Current SQL query:
TRANSFORM Sum(report.[Box quantity]) AS [SumOfBox quantity]
SELECT Val(report.[Inspector Number]), Sum(report.[Box quantity]) AS [Total Of Box quantity]
FROM report
GROUP BY report.[Inspector Number]
PIVOT Format([Date Issued],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
Extract year and week parts from date value for row and column headers. Consider:
TRANSFORM Sum([Box quantity]) AS [SumOfBox quantity]
SELECT Val([Inspector Number]) AS InsNum, Year([Date Issued]) AS Yr, Sum([Box quantity]) AS [Total Of Box quantity]
FROM report
GROUP BY [Inspector Number], Year([Date Issued])
PIVOT DatePart("ww", [Date Issued])
If you want to assure a column for every week is generated, can use IN():
In (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53)
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.
My query includes 4 groups. Category > Type > Activity > Nature > detailPrice.
I have the report built with 4 different List Items stacked into each other. Each list is one of the four groups. The detailPrice is a table (pink).Each of the 4 groups has a different colored border, to differentiate (just for testing).
Each list shows a Total of the previous list. List 2 (Activity) shows the sum total of the entries in List 1 (Nature), and so on. The total of List 4 (Category) shows the grand total of all the previous lists.
My 3rd List's group (Type) is always split into two sections: Revenue and Expenses. So there are two totals in the 3rd List's grouping: the first is 90033, the second is 37627.
Here's the total of Revenue. Only the first number matters, which is 90033.
Inside my fourth list (Category), rather than just show the grand total (of Revenue - Expense), I want to show both the total of Revenue and Expenses, and then show the grand total.
For the Grand Total, I simply sum the proper field. But I am unable to get the 90033 and 37627 I need.
I've tried many different options:
When the 3rd list sums the Revenue, I put that value in a custom code variable, and then the same with Expenses. =IIF(Fields!Type.Value = "Revenue", Code.addTotal("R",SUM(Fields!detailPrice.Value)) (the function simply adds the detailPrice to one of two variables: totalR and totalE depending on the first parameter)
I tried the same with a Report Variable =IIF(Fields!Type.Value = "Revenue", Variables!totalR.SetValue(SUM(Fields!detailPrice.Value)))
I also tried Running Values, but didn't get very far.
I can't simply access the ReportItem!total of the 3rd group, as I am trying to get it from outside the group.
After all my attempts, my two variables (totalR and totalE) have the same value: 37627. I can never get 90033 as well as 37627. I can get the total of Expenses... but not Revenues. I feel like the total of the Expenses group overrides the Revenue value, but I have no idea how to keep that 90033 to use it outside of the group.
Is it possible to reference each total in a group outside of said group?
I am using SSRS 2016 application to pull data from SharePoint list.
My task is to calculate the average DaysUsed and the average Percentage from a column.
It is a Matrix report which has two columns:
Sum(Fields!Days.Value)
Sum(Fields!Percentage.Value)
The task is to show the average days and average percentage.
I have tried the =Avg(Fields!Days.Value) but this shows wrong result.
UPDATE
Yes, the matrix is grouped by the Month to show each relevant month.
See the screenshot below what I have tested so far.
The DaysUsed is a calculated between 2 fields [FromDate] and [UntilDate] by summarising the total days minus the weekends. see below:
=(DateDiff(DateInterval.day,CDate(format(Fields!FromDate.Value,"MM-dd-yyyy")), CDate(format(Fields!UntilDate.Value,"MM-dd-yyyy")))+1)
- (DateDiff(DateInterval.WeekOfYear,CDate(format(Fields!FromDate.Value,"MM-dd-yyyy")), CDate(format(Fields!UntilDate.Value,"MM-dd-yyyy")))*2)
- IIF(Weekday( CDate(format(Fields!FromDate.Value,"MM-dd-yyyy")),1) = 1,1,0)
- IIF(Weekday( CDate(format(Fields!FromDate.Value,"MM-dd-yyyy")),1) = 7,1,0)
- IIF(Weekday( CDate(format(Fields!UntilDate.Value,"MM-dd-yyyy")),1) = 1,1,0)
- IIF(Weekday( CDate(format(Fields!UntilDate.Value,"MM-dd-yyyy")),1) = 7,1,0)
Furthermore, the [DaysUsed] row then consists of IIF(value is null then show 0 otherwise show the total value of days used).
=IIF(IsNothing(Sum(Fields!Days.Value)), "0", Sum(Fields!Days.Value) )
Sum(Fields!Days.Value)/CountRows()
Shall give you average days. Similarly goes for others as well.
If you has a field called Fields!Days.Value, I guess your data in the screenshot is already grouped by month. This means the expression
=Avg(Fields!Days.Value)
gives you the average over all Days (sum of all days / count of all days).
If you want to use the grouped values (by mounth) you either can use the following expression when you are inside the scope (the monthly socpe; indicated by the brackets on the most left side on your tablix)
=Sum(Fields!Days.Value) / Count(Fields!Days.Value)
If you are not in the scope you have to tell the tablix that is should use your monthly grouping. For this you can use the following:
=Sum(Fields!Days.Value, "YourMonthGroupName") / Count(Fields!Days.Value, "YourMonthGroupName")
Here I am, again with another doubt.
Here is my problem:
I have a report where I show ALL the incomes and expenses of the company for the last two days, which i managed by placing a column group grouping the columns by the date
Originally, the report contained a single matrix with both incomes and expenses fed by a dataset that points to the company cube applying the following filter expression
=IIF(Fields!Fecha.Value=Parameters!FechaHoy.Value or Fields!Fecha.Value = Parameters!DiaAnterior.Value,true,false)
FechaHoy = date sent via report parameter input
FechaAyer = date
parameter minus one day
and the filter value set to
=true
So far so good. Today, the upper management decided to split it into three matrix. One for incomes and other two for expenses (one for each expense category), so i startet with this
initial report layout
I created two new datasets for each one of the expense categories with the same filters, and now i'm here
current report layout
THE THING IS... as you can see, there is a "Total Destino" independent table where i have to add the totals of the second and third matrix in the image I added, but, as I already said I have to show the last two days, so i also have to partially add the total of each day (which are column grouped by date)
I'm pretty sured that there's also a better and more efficient way to manage what I did with the three matrices but the main issue which needs your assistance is how do i add the totals of the second and third matrices.
I already tried with
=Sum(Fields!Saldo.Value, "Informacion_Destino") + Sum(Fields!Saldo.Value, "Info_InvTesoreria")
but it adds the two days and repeat it for the two days. I also tried with ReportItems!TextBox + ReportItems!TextBox but the preview loads sends me an error message.
Thanks in advance for your time and help
Like Harry stated already out you can use for your overall total the following expression for the Tesoreria Subtotal + Destino Subtotal :
=ReportItems!TesoreriaSubtotal.Value + ReportItems!DestinoSubtotal.Value
This would give you the overall total for all days. Now if you just have to show the last two days you can add a tablix filter, like this:
'Expression
=IIF(CDate(Fields!YourDate.Value) < DateAdd("d", -2, Now()), True, False)
'Format
=Boolean
'Value
=False