{
  "id": 14624809,
  "title": "The SQL Behind an AI Visibility Dashboard: Five Metrics and Their Traps",
  "url": "https://urgent.news/2026/10/15/the-sql-behind-an-ai-visibility-dashboard-five-metrics-and-their-traps",
  "topic": "ai",
  "section": "AI",
  "published": "2026-10-15T06:00:00.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/furqank729/the-sql-behind-an-ai-visibility-dashboard-five-metrics-and-their-traps-30h3"
  },
  "original_language": "en",
  "account": "As daily outputs from LLMs accumulate for brand mention scoring, they can easily lead to misleading visualizations. This is due to several factors inherent to this type of data, including non-deterministic answers, small sample sizes per prompt, significant variation between engines, and ever-changing competitor sets. This article outlines five key metrics to display on an AI visibility dashboard using SQL, along with essential safeguards to ensure accuracy. The database schema used for these metrics is based on a previous series.\n\nTo begin, create a view named v_scored that combines data from run, prompt, score, and brand tables. This view will serve as the foundation for calculating the metrics. By pinning the scorer_version here, any future upgrades to the scoring system can be made through a single line change instead of hunting through multiple chart queries.\n\nMetric 1 explores the visibility rate, which indicates the share of answers that mention your brand. Given the variability in daily sample sizes, it's advisable to present a 7-day rolling rate alongside the daily points. This can be achieved by using a window function that sums the 'mentioned' values and the total number of runs within a partitioned window ordered by engine and date. Be cautious of two potential pitfalls: uneven weightage due to varying sample sizes and silent extension of the window when a day is missed in the collection process.\n\nMetric 2 focuses on the share of voice (SOV), which represents the brand's share of all mentions across all tracked brands within each engine. The denominator should consist of mentions of all tracked brands to maintain relevance when the competitor set remains constant. The query calculates SOV for the last 28 days and orders the results by engine and descending SOV. However, be mindful of the risk of altering the competitor set midway through the analysis, as this would distort the SOV values for existing brands.\n\nMetric 3 presents average position, but only when the answer appears within a list format and the brand is part of it. In these cases, the average position is displayed in conjunction with the count of positions it's based on, rather than alone. This ensures that the metric remains contextually relevant. When querying the database, include a where clause for is_ours = 1 and the relevant date range. Exclude any results where the 'position' value is null to maintain data integrity.\n\nIn summary, these five metrics—visibility rate, share of voice, average position (when applicable), and the associated safeguards—provide a solid foundation for an AI visibility dashboard. By following the provided SQL queries and being aware of the potential traps, you can ensure accurate and insightful visualizations that effectively communicate your brand's online presence.",
  "summary": "Once you're collecting LLM answers daily and scoring them for brand mentions, someone will ask for a dashboard. That's when a pile of good data turns into misleading charts. The traps are specific to this kind of data. Answers are non-deterministic, sample sizes per prompt are small, engines differ wildly, and the competitor set changes. This post writes the five metrics worth putting on a…",
  "key_points": [
    "Create view vscored combining run, prompt, score, and brand tables",
    "Metric 1: Visibility rate with 7-day rolling sum, beware uneven weightage and missed days",
    "Metric 2: Share of voice across all tracked brands, monitor competitor set changes"
  ],
  "editors_take": "Implementing specific SQL safeguards against non-deterministic data and fluctuating competitor sets transforms raw LLM outputs into reliable brand intelligence rather than misleading visualizations.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}