# Dashboard Report - System

**URL:** <https://meta.discourse.org/t/dashboard-report-system/293546>\
**Category:** Data & reporting\
**Tags:** sql-query, dashboard-reports, dashboard-sql\
**Created:** [January 30, 2024, 10:39pm UTC](https://meta.discourse.org/t/dashboard-report-system/293546 "2024-01-30T22:39:29Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![SaraDev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saradev/32/335139_2.png) [@SaraDev](https://meta.discourse.org/u/SaraDev)\
**Post date:** [March 14, 2024, 5:56pm UTC](https://meta.discourse.org/t/dashboard-report-system/293546/3 "2024-03-14T17:56:32Z")

</div>

> [@Jumanji](#):
>
> Can this be tied to a specific PM, like the welcome PM?

Yes, the best way to add this in would be to add a section to the `WHERE` statement in the query, filtering by topic `title`.

For example:

```sql
WHERE archetype = 'private_message'
  AND subtype = 'system_message'
  AND created_at BETWEEN :start_date AND :end_date
  AND title = 'Greetings!'

```

Would find all of the `Greetings!` messages.

Note that some of the system messages do not include a real user, so removing the line `AND user_id > 0` may be necessary with this type of query.

You may also want to remove `AND deleted_at IS NULL` to still count welcome messages that users might delete.

You could use regex to match topics with a similar title.

To match a topic by title using a regular expression (regex) in PostgreSQL, you can use the `~` operator, which matches a regular expression against a string. The query structure would look like this:

```sql
SELECT *
FROM topics
WHERE title ~ 'YourRegexPatternHere'

```

Replace `'YourRegexPatternHere'` with the actual regex pattern you want to match against the `title` field.

For example, if you’re looking for topics with titles that contain the word “Welcome” (case-insensitive), you could use:

```sql
SELECT *
FROM topics
WHERE title ~* 'Welcome'

```

The `~*` operator is used for case-insensitive matching.

---

_[View the full topic](https://meta.discourse.org/t/dashboard-report-system/293546)._
