I have an ssrs report with dataset that has two fields. I grouped on field 1 and then I grouped on field 2 and now I want to just show the count of each unique items within the child group.
here is what Dataset looks like
Route Driver
A Adam
A Adam
A John
B Adam
A John
and so on
Here is what I'm trying to make my report look like
Route Driver Count
A
Adam Count of number of times Adam appears in this child group.
John Count of John
Total total for all
B
Adam 25
Mike 5
Total total
C
Josh 10
and so on
However, here it is what it looks like at the moment.
Route Driver Count
A
Adam count
count
count
count
continues till the number of times Adam appears
B
Adam 25
25
25
25
continues 25 times
Mike 5
continues 5 times
C
Josh 10
continues 10 times
here is my design view
Any suggestions on how to do this? I'm open to modifying my dataset too.
Insert a matrix, add route and driver as row groups. In the right most column enter the expression: =count(Fields!Driver.Value)
#Caesar Tex, to add Drivers total for each route as a header:
In your table you should have two levels of grouping - on Route and then on Driver - and no Detail row. The Route group has a header for the row title and a footer for the subtotal and the Driver group can just have the footer row, no need for a header.
Then just have your Count expression on each of the group footers.
Related
pnr mnd pris
1 1 600
1 7 900
2 1 600
2 7 600
3 1 40
3 7 40
I have trouble how to sum specific rows on the columns. Looking at the above, the table is called travel and it has 3 columns:
pnr - Personal Number
mnd - Month
Pris - Price
So what I want is to sum total of the price for the a specific month, so in this case, it should be 1240 USD and month 1. For the month 7, it should be 1540 USD.
I have trouble to do the query correct. So far from I have tried is this:
SELECT t.rnr, t.mnd, SUM(t.pris)
FROM travel AS t
WHERE t.mnd = 1
The result I get is 3720 USD which I have no idea how the SQL managed to calculate this for me.
Appreciate if someone could please help me out!
For this you need to drop the pnr column from the output (it is not relevant and will cause your data to split) and add a GROUP BY:
SELECT t.mnd, SUM(t.pris)
FROM travel AS t
WHERE t.mnd = 1
GROUP BY t.mnd
Live demo: https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=b34ec2bb9c077c2d74ffc66748c5c142
(The use of an aggregate function without grouping, as you've got now, is not a standard SQL feature and can often be turned off in MySQL. If turned on, you might not always get the result you expected/intended.)
just group your result with mnd column
SELECT t.mnd, SUM(t.pris)
FROM travel AS t
group by t.mnd
I have a report with a grouping of Category which each present their own totals lines. I would like to subtract the total of one group from the total of a separate group.
Group Clients Revenue ATC
Called 1000 50000 50.00
Control 100 1000 10.00
Here is what I want to do:
Variance 900 49000 40.00
Keep in mind that the called and control are already set as a grouping and there is underlying data that can be expanded to show each store's data.
Any suggestions would be helpful.
Thanks,
Scott
If you want to get the variance I assume you only have two groups.
Try this for Clients:
=Sum(IIF(Fields!Group.Value="Called",Fields!Clients.Value,0))
-
Sum(IIF(Fields!Group.Value="Control",Fields!Clients.Value,0))
This for Revenue:
=Sum(IIF(Fields!Group.Value="Called",Fields!Revenue.Value,0))
-
Sum(IIF(Fields!Group.Value="Control",Fields!Revenue.Value,0))
And this for ATC:
=Sum(IIF(Fields!Group.Value="Called",Fields!ATC.Value,0))
-
Sum(IIF(Fields!Group.Value="Control",Fields!ATC.Value,0))
Let me know if this helps.
I have a database that tracks invoice payment certification. I am trying to build a report that will bring The following info in
Service Line - ABC
Total "unique" records - 2
max age - 3
Min age - 1
Avg of max age - 3
count of records over 14 days - 0
count of records under 14 days - 2
score: records under 14 days/total records - 100%
I am trying to build the report from a query that includes a date range. the important column names are:
Service Line DLN Age in days
ABC 123456 1
DEF 987654 3
ABC 123456 2
DEF 987654 4
ABC 123456 3
The DLN is an identifier to each different invoice number. I entered the data in above that I need it to return as it correlates to the table below.
I totally forgot I asked the question on here and ended up fixing the issue. What I ended up doing is building the report from scratch from the query instead of using the wizard. Then I just free typed the functions into unbound text boxes. I did then use the grouping to separate it the way I needed. Once I realized my mistake and that the solution was so easy I felt kind of dumb.
I have a report with one group of which the visibility is toggled based on if the [total] is greater than 5. I want to make another row, that adds up only the visible information from each column. The first column is the owner name, The 3rd column [total] gets divided by the second column to get the 4th [avg] column. Right now it's counting everything, including the hidden rows.
Also, columns 2-4 are calculated based on expressions
Example of what I want it to look like
Owner Count Total AVG
Bob 3 12 4
Jane 1 9 9
Marcos 2 24 12
TOTAL: 6 45 7.5
I also need to count the visible Owners total, and divide that by the total amount of active owners, which I pull from a second dataset.
Example if we had 12 owners total
Total listed owners: 3
% of owners: 25%
For the total displayed owners, just SUM on the expression you use to hide the row:
=SUM(IIF(Fields!Total.Value > 5, 1, 0))
then to get the percent, divide this by the COUNT of the total rows, including the hidden ones (which you already have).
I have a report in a tablix with 1 to x column groups. In the totals for each row, is it possible to refer to only say the last 2 groups? The requirement is to add a column that shows the most recent % change between the last 2 groups.
Jan Feb Mar |Total Recent % Change
5 10 5 20 50%
1 3 6 10 200%
I ended up using the technique I learned in this post: Creating conditional total rows in SSRS
Basically, I added another field with the ranking/order of the Groups in descending order (so that the most recent group is #1).
Example of the expression: (Note that I have custom code to do the divide so that I don't get divide by zero errors.)
=code.divide(sum(iif(fields!Last_ORDER.Value=1,fields!Num_Apps_Submitted.Value,0)),sum(iif(fields!Last_ORDER.Value=2,fields!Num_Apps_Submitted.Value,0)))