Calculating messages received this month

Hey all,

I’m trying to show a number of messages received ‘this month’ for each user. I can do a Search for messages:count, but I don’t know how to only limit it to showing for ‘this month’. Any ideas?

Thanks

  1. Make sure you have a list of Messages in the User table. This way, your initial search only includes Messages with that User (makes searches more efficient).

  2. Are you doing the current month or the last 30 days? If you’re doing the “last 30 days”, obviously add a constraint that only shows Messages with a creation date in the last 30 days. If you’re doing “current month”, here’s the best way to do it:

Add a NUMBER field to the Message database table. When a Message is created, this field should hold the month that the Message is created. Then, when displaying your list of Messages for “this month”, add a constraint where the month field (in the Messages table) is equal to the current date’s: extract month.

Hope that makes sense!

1 Like

Thanks @dbevan - I think I have it working now!

I’m doing: Search for Messages’s Creation Date:extract month:count

And the constraint in the search is: recipient = Current User.

Seems to be returning the correct number!

My only concern is the function of :extract month - does this essentially mean all entries within the last month (e.g. March so far), or all entries within the last 30 days?

March so far.

If you’re searching for messages, remove the “Creation Date:extract month:count”
The other constraint would be “month (number field) = current date:extract month”

Ah I see - so when a message is created, do I save the following: ‘NUMBER FIELD = current date/time:extract month’?

And then in my constraint where I’m displaying the messages this month, the month would match up?

If I also want to do ‘messages received today’, do I need to have a separate number field for ‘current date/time:extract day’?

100% Correct!

Exactly!

1 Like

Awesome, thanks!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.