# 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:** 7

<div class="post-metadata">

**Author:** ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)\
**Post date:** [December 21, 2022, 9:53am UTC](https://meta.discourse.org/t/data-explorer-group-report-parameter-bug/249525/7 "2022-12-21T09:53:16Z")

</div>

As a fun extra tip while Isaac takes a look at that, you can also use the `user_id` parameter to get a swish auto-complete parameter box. eg:

```plaintext
-- [params]
-- user_id :user
-- 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 = :user
)

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

```

---

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