简体   繁体   中英

Repeating row numbers in SSRS 2008

Trying to get a report to display a singluar intance of a row count, which I finally got working (Why is RowCount more complicated than it needs to be?) Which brings me to my next point, it displays the number of rows the amount of times that the row shows up!

在此处输入图片说明

Here's the formula that I am using: 在此处输入图片说明

SQL for this:

select distinct
    [File Number] = fm.FileNumber,
    [Client] = pc.Name, --Join FPR & PartnerType (PartnerTypeID = 1)
    [Abstractor] = pc1.Name, --PTID = 12
    p.State,
    [Title Order Date] = CONVERT(VARCHAR,fm.OpenedDate,1),
    [Title received date] = CONVERT(VARCHAR,fm.OpenedDate,1),
    [Date Title search order placed] = CONVERT(VARCHAR,fa.SentDate,1), --ADID = 18
    [ETA to title order search received] = DateAdd(day,3,fa.SentDate),
    [Actual received date] = CONVERT(VARCHAR,fa1.ReceivedDate,1),  --ADID = 19
    [Examination Date] = CONVERT(VARCHAR,fa2.SentDate,1),  --ADID = 654
    [Examiner] = IU.Firstname + ' ' + IU.LastName,  
    [Commitment Date] = CONVERT(VARCHAR,sd.CommitmentEffDate,1),
    [Final product to client] = CONVERT(VARCHAR,fa3.ReceivedDate,1)  --ADID = 799   
    ,pc.PartnerCompanyID as 'Client ID', pc1.PartnerCompanyID as 'Abstractor ID', InternalUserID
from FileMain fm
join FilePartnerRel fpr on fpr.FileID = fm.FileID AND fpr.PartnerTypeID = 1
join FilePartnerRel fpr1 on fpr1.FileID = fm.FileID AND fpr1.PartnerTypeID = 12
join PartnerCompany pc on pc.PartnerCompanyID = fpr.PartnerCompanyID
join PartnerCompany pc1 on pc1.PartnerCompanyID = fpr1.PartnerCompanyID
join FileActions fa on fa.FileID = fm.FileID and fa.ActionDefID = 18
left join FileActions fa1 on fa1.FileID = fm.FileID and fa1.ActionDefID = 19
left join FileActions fa2 on fa2.FileID = fm.FileID and fa2.ActionDefID = 654
left join FileActions fa3 on fa3.FileID = fm.FileID and fa3.ActionDefID = 799
join SearchData sd on sd.FileID = fm.FileID
left join InternalUser iu on iu.InternalUserID = fa2.SentUserID
join property p on p.FileID = fm.FileID
Where
fm.OpenedDate between @StartDate and @EndDate

What I am trying to do is get the "total" to only report 1 instance of the counted rows, see below: 在此处输入图片说明

You need to add a group, or if the group already exists in your table, then you need to add the column to your group, not to the details group.

Try right clicking on the column containing the field that is being used for the group, and choosing "Insert Column -> "Inside Group - Right" Place your countrows() expression in the resulting cell.

The different ways of grouping and including columns or rows in or out of different groups will be key to building slightly more complex reports. If you are going to be using SSRS much, it's worth learning these. Google SSRS Groups for many links and tutorials, such as this Technet reference.

It's not really clear what you're trying to accomplish but are you able to use SQL to get the count you need? (ie return a "Record Count" column from your SQL statement and use it in your report)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM