Im trying to figure out an Expression in SSRS.
I have 1000s of account details in a DB.
What i want to do is create a table that gives a count of members in each state like :
State Members
AK 234
AL 654
AR 643
How do i add a subgroup to this expression
=CountDistinct(Fields!Agent_External_ID.Value)
Right now it results in the same person being counted twice as the state is not grouped.
Related
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.
at the moment I have two tables. I have one table that displays loan summaries.
Loan Client Balance
11 Bob 100000
20 Steven 100000
33 Michael 100000
I need to enhance this table by adding Loan.Notes
Loan Client Balance
11 Bob 50000
2015-05-06 - Bob came into the office and said we should expect late payments
20 Steven 100000
2015-05-06 - Steven came into the office and he will pay this friday
2015-05-06 - Steven came into the office and said we should expect late payments
33 Michael 700000
The Notes section has two columns, Date of note and the Note.Subject. May I ask how do I add in the notes section onto the tablix?
First you need to create the query joining Loan with the 'LoanNotes'.
In your main table group by Loan. In the header of that group show Loan #, client and balance.
In the Detail section based on your requirements merge the column and show the Notes Data. In the following case I merged three columns and created a expression as =Fields!NoteDate.Value & " - " & Fields!Subject.Value
Now when you run the report you will get the data as you want.
Optional: In the case where there is no note you will need to write an expression in visibility tab to hide your detail row
=IIF(CountRows("LoanGroup") = 1, True, False)
OR
=CountRows("LoanGroup") = 1
The best approach for this is to combine the tables into one datatable joining on a similar key.
You can join the tables in your dbms by using queries to create a new view. or you could use this DataSet JOIN Helper.
You can then group in your Tablix as you see fit.
Another solution would be to add multiple DataSets within the same report.
Using multiple datasets in RDLC
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.
Hi I need help with crystal report! Currently stuck on one part.
In my MySql database I currently have the data for date, paytype, descript and amount. Which currently looks something like this: (Just a small part of the entire db)
date paytype descript amount
2013-07-01 SD Student Debit 50.00
2013-08-10 C Cash 30.00
2013-08-18 SD Student Debit 100.00
2013-10-01 SD Student Debit 70.00
2013-11-07 C Cash 100.00
2013-12-16 G Credit Card 25.00
I want to make it so that it will show the total amount based on each paytype/descript and between some dates. I could make it in mysql query so that it looks like this
select
`transact`.`date`,
`transact`.`paytype`,
`transact`.`descript`,
sum(`amount`) AS `Total`
from
`transact`
group by `transact`.`paytype`
However, although this does give me what I want, the dates gets stuck with the date the paytype spending starts, e.g it comes out like this:
date paytype descript amount
2013-07-01 SD Student Debit 220.00
2013-08-10 C Cash 130.00
2013-12-16 G Credit Card 25.00
notice how although I do get the total based on each paytype, but the date associate with it is the first date the paytype transaction occured. Now this is where my problem comes...
If I want to do a filtering based by date range to show the types of transactions that occured in between in crystal report.. I am now only left with the option to select these queried dates (and e.g if I choose date for 2013-10-01 which original has a SD paytype transaction, but now it would not show because SD total gets stuck with 2013-7-01).
Is there anyway I can query this but still leaving me all the dates? Or would I be able to do a formula somewhere from crystal report end to fix this problem? Thanks so much and apologize for the long post!
If you directly do the grouping then you can't achiwve your requirement instead use the Crystal Reports for grouping. My idea would be:
Instead of groupby quert use below query in command.
select
`transact`.`date`,
`transact`.`paytype`,
`transact`.`descript`,
`amount` `Total`
from
`transact`
Create two date parameters Startdate and Enddate.
Now create a group in CR withtransact.paytype
Place amount and date in detail section.
Now take summary in group footer and don't supress detail... dispaly both detail and group.
This should work let me know incase any issue
compliment of the day.
Based on the previous feedback received,
After creating a Ticket sales database in MS Access. I want to use a single form to Query the price of a particular ticket at a particular month and have the price displayed back in the form in a text field or label.
Below are sample tables and used query
CompanyTable
CompID CompName
A Ann
B Bahn
C Can
KK Seven
- --
TicketTable
TicketCode TicketDes
10 Two people
11 Monthly
12 Weekend
14 Daily
TicketPriceTable
ID TicketCode Price ValidFrom
1 10 $35.50 8/1/2010
2 10 $38.50 8/1/2011
3 11 $20.50 8/1/2010
4 11 $25.00 11/1/2011
5 12 $50.50 12/1/2010
6 12 $60.50 1/1/2011
7 14 $15.50 2/1/2010
8 14 $19.00 3/1/2011
9 10 $40.50 4/1/2012
Used query:
SELECT TicketPriceTable.Price
FROM TicketPriceTable
WHERE (((TicketPriceTable.ValidFrom)=[DATE01]) AND ((TicketPriceTable.TicketCode)=[TCODE01]));
In MS Access, a mini boxes pops up to enter the parameters when running the query. How can I use a single form to enter the parameters for [DATE01] and [TCODE01]. and the price displayed in the same form in a textfield (For further calculations).
Such as 'Month' field equals to input to [DATE01] parameter
'Ticket Code' equals to input for [TCODE01] parameter
Textfield equals to output of the query result (Ticket price)
If possible, I would like to use only the Month and Year in this format MM/YYYY.The day is not necessarry. How can I achieve it in MS Access?
If any question, please don't hesitate to ask
Thanks very much for your time and anticipated feedback.
You can refer to the values in the form fields by using expressions like: [Forms]![NameOfTheForm]![NameOfTheField]
Entering up to 300 different types of tickets
Answer to your comment referring to Accessing data from a ticket database, based on months in MS Access)
You can use Cartesian products to create a lot of records. If you select two tables in a query but do not join them, the result is a Cartesian product, which means that every record from one table is combined with every record from the other.
Let's add a new table called MonthTable
MonthNr MonthName
1 January
2 February
3 March
... ...
Now if you combine this table containing 12 records with your TicketTable containing 4 records, you will get a result containing 48 records
SELECT M.MonthNr, M.MonthName, T.TicketCode, T.TicketDes
FROM MonthTable M, TicketTable T
ORDER BY M.MonthNr, T.TicketCode
You get something like this
MonthNr MonthName TicketCode TicketDes
1 January 10 Two people
1 January 11 Monthly
1 January 12 Weekend
1 January 14 Daily
2 February 10 Two people
2 February 11 Monthly
2 February 12 Weekend
2 February 14 Daily
3 March 10 Two people
3 March 11 Monthly
3 March 12 Weekend
3 March 14 Daily
... ... ... ...
You can also get the price actually valid for a ticket type like this
SELECT TicketCode, Price, ActualPeriod AS ValidFrom
FROM (SELECT TicketCode, MAX(ValidFrom) AS ActualPeriod
FROM TicketPriceTable
WHERE ValidFrom <= Date
GROUP BY TicketCode) X
INNER JOIN TicketPriceTable T
ON X.TicketCode = T.TicketCode AND X.ActualPeriod=T.ValidFrom
The WHERE ValidFrom <= Date is in case that you entered future prices.
Here the subquery selects the actually valid period, i.e. the ValidFrom that applies for each TicketCode. If you find sub-selects a bit confusing, you can also store them as query in Access or as view in MySQL and base a subsequent query on them. This has the advantage that you can create them in the query designer.
Consider not creating all your 300 records physically, but just getting them dynamically from a Cartesian product.
I let you put all the pieces together now.
In Access Forms you can set the RecordSource to be a query, not only a table. This can be either the name of a stored query or a SQL statement. This allows you to have controls bound to different tables through this query.
You can also place subforms on the main form that are bound to other tables than the main form.
You can also display the result of an expression in a TextBox by setting the ControlSource to an expression by starting with an equal sign
=DLookUp("Price", "TicketPriceTable", "TicketCode=" & Me!cboTicketCode.Value)
You can set the Format of a TextBox to MM\/yyyy or use the format function
s = Format$(Now, "MM\/yyyy")