Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Counting Distinct Values for a Chart

Featured Replies

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

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.

  • Author

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

 

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.