Jump to content
Sign in to follow this  
Greg Hains

Counting Distinct Values for a Chart

Recommended Posts

Good morning.

I am having trouble displaying data in a chart - this may be as much about schema and relationships as it is about charts, but here goes...

I have a table called "SOAP Notes". This table has about 12,000 records. In this table, two of the fields are Date (a date field - surprise!) and Date_Count field - a calculation field that reads this:
ExecuteSQL ("SELECT Count ( \"Date\" ) FROM \"SOAP Notes\" WHERE \"Date\" >= ? AND \"Date\" <= ?" ; ""; ""; Date; Date)

This calculation field gives me a count of any given day - works fine.
I then narrow down the data to be displayed with a FIND (for example "9/2018" in the Date field), I still get repeats of the same date, so there might be 10 items in the chart that are for 1/9/2018 when I really only want to show 1 entry per day - a total of 30 for the month of September.

I cannot work out how to apply the DISTINCT option to the above statement.
It may be "lazy" but I feel I can achieve this result without creating a plethora of relationships to other tables and only modifying this statement a little.

Could somebody please throw me a clue?
Thank you in advance.
Greg

Share this post


Link to post
Share on other sites

I am somewhat confused by your description- and especially by the title. If I understand this correctly, you do NOT want to count distinct values; you want to display (only) distinct values along the X axis, and show their count within the current found set as the Y axis values - is that correct?

If so, I suggest this would be much simpler to accomplish using Filemaker native methods: define the chart to use the Date field as the X axis labels and a summary field defined as Count of [any field that cannot be empty] as the Y axis data. Set the chart to use data from the current found set, and select the Summarized groups of records option for Chart display when layout is sorted.

Before displaying the chart,  find the relevant records and sort them by the Date field.

Share this post


Link to post
Share on other sites

Hi Comment,

Thank you once again for coming to my rescue. :)
Yes, my description could have been better, but you knew what I meant.

I did have all the settings correct as you described, but I did not sort the records again. Once they were sorted, everything came good.

Cheers,
Greg

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.