# Dashboard Report - Overall Sentiment

**URL:** <https://meta.discourse.org/t/dashboard-report-overall-sentiment/295428>\
**Category:** Data & reporting\
**Tags:** ai, sql-query, dashboard-reports, ai-sentiment, dashboard-sql\
**Created:** [February 15, 2024, 1:24am UTC](https://meta.discourse.org/t/dashboard-report-overall-sentiment/295428 "2024-02-15T01:24:10Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![SStrong](https://avatars.discourse-cdn.com/v4/letter/s/ee7513/32.png) [@SStrong](https://meta.discourse.org/u/SStrong)\
**Post date:** [July 3, 2025, 9:27am UTC](https://meta.discourse.org/t/dashboard-report-overall-sentiment/295428/3 "2025-07-03T09:27:05Z")

</div>

> [@SaraDev](#):
>
> ```plaintext
> -- [params]
> -- date :start_date = 2024-01-13
> -- date :end_date = 2024-02-14
> -- double :threshold = 0.60
> 
> SELECT
> DATE_TRUNC('day', p.created_at)::DATE AS date,
> COUNT(CASE WHEN (classification->>'positive')::float > :threshold THEN 1 ELSE NULL END) AS positive_sentiment_posts,
> COUNT(CASE WHEN (classification->>'negative')::float > :threshold THEN 1 ELSE NULL END) AS negative_sentiment_posts,
> COUNT(CASE WHEN (classification->>'positive')::float > :threshold THEN 1 ELSE NULL END) - COUNT(CASE WHEN (classification->>'negative')::float > :threshold THEN 1 ELSE NULL END) AS overall_sentiment
> FROM
> classification_results AS cr
> INNER JOIN posts p ON p.id = cr.target_id AND cr.target_type = 'Post'
> INNER JOIN topics t ON t.id = p.topic_id
> INNER JOIN categories c ON c.id = t.category_id
> WHERE
> t.archetype = 'regular' AND
> p.user_id > 0 AND
> cr.model_used = 'cardiffnlp/twitter-roberta-base-sentiment-latest' AND
> (p.created_at > :start_date AND p.created_at < :end_date)
> GROUP BY
> DATE_TRUNC('day', p.created_at)
> 
> ```

I’ve tried running this, getting 0 results however we do have sentiment analysis and AI ticket, can see it in that front end report but not from this query

---

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