The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Any way to include empty grouped by time columns

Jeff Sumner
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 14, 2025

I have an Analytics report which shows Major Production bugs by Quarter. Chart looked nice, but we got the number of bugs down to 0 the last couple of quarters and so those come back as empty rows for my query - I'd like them to show as a 0 column in my chart, not get skipped. Any way to do this?

SELECT CONCAT(DATE_FORMAT(`Issue`.`created_at`, 'y'), '-Q', QUARTER(`Issue`.`created_at`)) AS `CY Quarter`,
COUNT(DISTINCT `Issue`.`issue_id`) AS `Count of unique Issue Issue ID`
FROM `jira_issue` AS `Issue`
<snip>
WHERE `Issue`.`issue_type` IN ('Bug')
AND `Issue`.`created_at` >= TIMESTAMP({CALENDAR.START})
AND `Issue`.`created_at` < (TIMESTAMP({CALENDAR.END}) + INTERVAL 1 DAY)
GROUP BY CONCAT(DATE_FORMAT(`Issue`.`created_at`, 'y'), '-Q', QUARTER(`Issue`.`created_at`))
LIMIT 100000;

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Inder Singh
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 3, 2025

@Jeff Sumner One way to do this would be to:

  1. Write a separate SQL query to generate just the timeline (see query below)
  2. Outer join the output of above with your original query
  3. Use "zero fill" step to fill zeros in empty quarters

 

Here is the query you can use for step 1:

with date_range as (
SELECT sequence(to_date({CALENDAR.START}), to_date({CALENDAR.END}), interval 1 day) as date_day
),

date_range_explode as (
SELECT explode(date_day) as all_days from date_range
),

years_qtrs as (
SELECT concat(YEAR(`all_days`), '-Q', QUARTER(`all_days`)) AS `yrqtrs`
from date_range_explode
group by yrqtrs
)

SELECT * from years_qtrs

 

Thanks,

 

Inder

0 votes
Tomislav Tobijas
Community Champion
May 26, 2025

Hi @Jeff Sumner ,

I'm just gonna move this to Atlassian Analytics group as this is more related to that app, as I guess you'll get better assistance there.

Cheers,
Tobi

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
ENTERPRISE
TAGS
AUG Leaders

Atlassian Community Events