Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Need to count or sort by number of labels.

This question appears to have done the rounds with most answers being about buying an addon or creating a script. 

I've noted that in JQL you can ORDER BY labels and this will alphabetise one way or the other. However I need to sort by the number labels either as a count or by sorting the results.


2 answers

1 accepted

0 votes
Answer accepted

Hi Andrew,

Unfortunately, there are no native ways to get what you need: an app or script would be required.

As a workaround, you may:

  1. Go to the issue navigator and save as a filter the query you would like to order by labels.
  2. Ensure the Issue Key and the Labels fields are being shown in your selected columns.
  3. Export the results to Excel CSV (current fields only):
  4. Open the resulting CSV file with a text editor and replace all commas (,) with semicolons (;). Save the changes.
  5. Open the modified file with Excel and add a new column titled #Labels. Use the COUNTA(<range>) function to count the number of non-blank values under any of the labels columns within the very same row:
  6. Click on the cell where you have just added the COUNTA function, then click on its bottom-right corner and drag & drop it down to the last row in the spreadsheet. That way, your formula will be copied to the remaining rows, but updating the range conveniently.
  7. Click on Data > Filter so that the buttons with the dropdowns appear on all column headers, and click on said button from the #Labels column header to select the order based on that value.

You may also filter data to hide rows (issues) that do not match your desired requirements.

Finally, you can also easily create a comma-separated list of issue keys from Issue Key column and paste it in a JQL like issuekey in (<your  comma-separated list of issue keys>), so that you can execute a filter in Jira that gets the issues you want and continue interacting back with those issues within the tool.

Hope it helps.

Thanks @Ignacio Pulgar . I had already done the workaround you suggested. Odd you can do a Zendesk ticket count and not a label count. At least I have a definitive answer that what I specifically want can't be done without an additional app or script.

Like Ignacio Pulgar likes this

@andrew.stuart how do you do the Zendesk ticket count ?

I just made a filter searching for a specific set of labels, Then added the Two Dimensional Filter Statistics Widget to a dashboard. Configured it to use Labels as one of the Axis. And now I have a count of each label.

Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you