Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Counting Number of Occurrences of a single date Post Reply Post New Topic
Author Message
LooSFS
Newbie
Newbie


Joined: 18 Mar 2016
Location: United States
Online Status: Offline
Posts: 5
Quote LooSFS Replybullet Topic: Counting Number of Occurrences of a single date
    Posted: 19 Jul 2016 at 11:07am
Hi all,

Very new to the forum, so I hope I do this correctly. I am a light user of CR11 and mostly use it for a robust report that our sales team pulls when they visit a client. I had help building by an expert, but have mostly been able to figure my changes/edits since (expert is now gone from my life :( )

I'm having trouble getting a count to work. I'm working in a sub-report and trying to get it to tally the number of times a client was visited in a season (let's say September 1-December 31). In our system, they may have listed 5 events for that client on one date, but I want the count to count that single date as one instance.

I've tried creating a formula for this and pulling in a Summary Count field as well as a Summary Distinct Count field, but neither seems to be working.

I have to admit to having stepped away from this for a number of months when I couldn't figure it out earlier this year...so, I think my formulas now represent some form of an earlier try. I'm basically running an: if a date(s) fall(s) between two specified dates and the status equals attend, then display the status field, else display null. I was then hoping my Summary Count would give me the number of times we visited that client during that time period (considering each distinct date a distinct visit).

I've just hit a road block, so if there is someone familiar with this kind of an equation and what Summary field settings I should use (or a few things I could try), I would be most grateful.

Thanks for any help!
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 19 Jul 2016 at 12:56pm
If the data is in chronological order.  I think a simple running total (distinct count) to evaluate when {date} <> next({date}. 
IP IP Logged
LooSFS
Newbie
Newbie


Joined: 18 Mar 2016
Location: United States
Online Status: Offline
Posts: 5
Quote LooSFS Replybullet Posted: 20 Jul 2016 at 3:28am
Thanks, Kevlray. Would I need to create a formula field and then do a summary - distinct count to sit in my footer (that's where my visible data is sitting)?

What exactly would my formula field say? Would it be something like:
if {date} <> next{date} then ???

And what do you mean by the data being in chronological order? It is getting pulled in from our database and I cannot be certain exactly what the order is filtered on.

Thanks!
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 20 Jul 2016 at 4:22am
Are you familiar with running totals?  One of the things you can do is to  is have the running total evaluate when a formula returns a true value.

Of course you could sort the data by chronological order (if it works for you in the report).
IP IP Logged
LooSFS
Newbie
Newbie


Joined: 18 Mar 2016
Location: United States
Online Status: Offline
Posts: 5
Quote LooSFS Replybullet Posted: 20 Jul 2016 at 4:34am
I'm not familiar with running totals. Is that something that can happen in a sub-report? There is one visible footer that is pulling into the main report page.

Also, the dates for our visits are not visible in this sub-report, so I'm also not sure about sorting the data by chronological order - only the tally fields are visible.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 20 Jul 2016 at 8:27am
You can use a running total anywhere (Field Explorer, Running Total Fields) in a report.  I am not clear how the sub-report is connected to the main report.  You seem to state that there is some sort of date range used in the sub-report, so I am not sure how dates are not available in the sub-report.
IP IP Logged
LooSFS
Newbie
Newbie


Joined: 18 Mar 2016
Location: United States
Online Status: Offline
Posts: 5
Quote LooSFS Replybullet Posted: 20 Jul 2016 at 9:07am
Hrm, I think we are seeing where my shortcomings with the program are! :) Maybe I'll try to re-explain a bit how this portion of the report is built.

On the main Design tab, there is a sub-report built into the Group Header #1b. This sub-report sits on it's own tab called, Visit Counts - it is set to display some limited text and the tallies (for which I'm trying to determine how to count). It looks something like this:
VISITS:
     Fall Spring
2015 (#)     (#)
2014 (#)     (#)
2013 (#)     (#)
2012 (#)     (#)

To get the (#), I'm trying to figure out how to tally a single instance of a specific date that is part of a database field available to that sub-report, but which is not included in the visual portion of the sub-report. It needs to tally based on year and portion of the year, as seen above.

My approach had been to try and create a formula field for which I could run a summary on to tally those visits. This summary field would sit in the visible portion of the sub-report to show up on the final main preview page.

I'm so sorry if this doesn't make any sense. It's a bit tricky for me to explain since I don't have a super solid working knowledge of what I should be looking for.

I haven't used Running Totals before and see where this is...but, I'm not exactly too certain how I should best set up the parameters. But, I can try to find a how-to...I tried playing with it a bit, but can't get any value to show up.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 20 Jul 2016 at 10:29am
Of course running totals do not need to rely on the visual portion of the report.  It would be useful to know what data elements are available in the sub-report data source.  By using the available data elements you may be able to accomplish your task either by a running total or as we call it, a manual running total by using a formula.
IP IP Logged
LooSFS
Newbie
Newbie


Joined: 18 Mar 2016
Location: United States
Online Status: Offline
Posts: 5
Quote LooSFS Replybullet Posted: 21 Jul 2016 at 3:08am
I have access to a number of data elements...specifically relating to visits, I have access to: Visit date, Visit type (meeting, presentation, fair, etc), Visit status (whether we attend or not), Staff member in charge of the visit.

I suppose I would only want to count those visits where there is a positive value for Visit Status (ie "Attend" as opposed to "Not Attend").
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.