# Data explorer group report - parameter bug

**URL:** <https://meta.discourse.org/t/data-explorer-group-report-parameter-bug/249525>\
**Category:** Bug\
**Tags:** data-explorer\
**Created:** [December 20, 2022, 9:30pm UTC](https://meta.discourse.org/t/data-explorer-group-report-parameter-bug/249525 "2022-12-20T21:30:20Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![piffy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/piffy/32/254198_2.png) [@piffy](https://meta.discourse.org/u/piffy)\
**Post date:** [December 20, 2022, 10:02pm UTC](https://meta.discourse.org/t/data-explorer-group-report-parameter-bug/249525/4 "2022-12-20T22:02:25Z")

</div>

```plaintext
--[params]
-- string :username
-- int :min_days = 10

WITH consecutive_visits AS (
  SELECT user_id,
       visited_at,
       -- The value of s will be the same for each group of consecutive days
       visited_at - (DENSE_RANK() OVER (PARTITION BY user_id ORDER BY visited_at))::int s
    FROM user_visits
    WHERE user_id = (SELECT id FROM users WHERE username = :username)
)

SELECT
MIN(visited_at) period_start,
COUNT(*) AS consecutive_days,
MAX(visited_at) period_end
FROM consecutive_visits
GROUP BY user_id, s
HAVING COUNT(*) >= :min_days
ORDER BY period_start DESC

```

I tried with [safe mode](https://meta.discourse.org/t/53504?silent=true) on (official plugins only) and have the same issue.

---

_[View the full topic](https://meta.discourse.org/t/data-explorer-group-report-parameter-bug/249525)._
