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
4,294,734
Community Members
 
Community Events
165
Community Groups

Custom sort a pivot table but not data table

Hi all! 

I manage a program that uses tickets. My page currently has full data table displaying information about all tickets in the program with a pivot table that summarizes all tickets by status. The Table Filter macro will filter both pivot table and data table.

I would like to sort the pivot in an order defined by me rather than alphabetically. I tried to use Table Transformer with SQL query that does this (WHEN T1.'Status' LIKE "Escalation Review" THEN "1"...) but I think the Table Transformer is attempting to sort the data table and not the pivot table. 

Is there a way for me to use Table Transformer to apply only to pivot table? Or another macro to use? 

2.PNG1.PNG

2 answers

1 accepted

Hello @Kelsey Lubbe

Please try this SQL query:

SELECT *
FROM T*
ORDER BY
CASE
WHEN T1.'Status' LIKE "Escalation Review" THEN 1
WHEN T1.'Status' LIKE "Root Cause Analysis" THEN 2
WHEN T1.'Status' LIKE "Corrective Action Plan" THEN 3
WHEN T1.'Status' LIKE "Pending Approval" THEN 4
ELSE 5
END

Katerina
Stiltsoft

Thanks, @Katerina Rudkovskaya _Stiltsoft_ . This is similar to the output I got previously. Screenshot here compared to output without Table Transformer. 

3.PNG

No Table Transformer

4.PNG

Hi @Kelsey Lubbe ,

Note that in your case, you can change the order of columns just choosing them with the help of autocompletion in Table Transformer according to your needs.

Please see my exampe below:

2021-08-06_17h11_50.png2021-08-06_17h12_13.png

Use autocompletion: start typing, e.g., T1. and choose the column.

2021-08-06_17h14_13.png2021-08-06_17h12_04.png

Katerina
Stiltsoft

Hi Katerina, 

Thank you! That did sort the top pivot table in the appropriate order.

Is it expected that the full data table (from Table from CSV in original screenshot) is hidden? The reason why I have the Pivot Table and data table nested inside the Table Transformer macro is because I want the Table Filter macro to apply to both Pivot Table and data table. 

Hi @Kelsey Lubbe,

You can set it to show or hide the source table in both Pivot Table and Table Transformer macros.

Oh my, I was expecting a checkbox to display/hide and did not expect a dropdown option. My bad on missing that! Thanks so much for the help @Andrey Khaneev _StiltSoft_ @Katerina Rudkovskaya _Stiltsoft_ !

Like # people like this

@Andrey Khaneev _StiltSoft_ I think I discovered an issue that simply needs some error handling.  It looks like if any of the defined columns does not have a task of that status (meaning count 0), it throws an error and the whole table will not display:

Error: Column does not exist: Count STATUSNAME

Does anyone have a recommendation on how to handle that scenario?  I have removed the column with a 0 count and the table displays correctly again.  However, we would like to display that column count when it does have tasks in that status... 

Thanks so much, the above info has been great in getting us this far!

@Sean M, please try to use COALESCE function in this case:

COALESCE(T1.'Count STATUSNAME')

I think I discovered an issue that simply needs some error handling.  It looks like if any of the defined columns does not have a task of that status (meaning count 0), it throws an error and the whole table will not display:

Error: Column does not exist: Count STATUSNAME

Does anyone have a recommendation on how to handle that scenario?  I have removed the column with a 0 count and the table displays correctly again.  However, we would like to display that column count when it does have tasks in that status... 

Thanks so much, the above info has been great in getting us this far!

Added to reply section.  Please disregard this.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence Cloud

Presenter Mode for Confluence is here 🖥 👩‍💻

👋  Hello Community!  My name is Stephanie Zhang, and I’m a product manager on the Confluence cloud team. Today, I’m excited to announce the rollout of  Presenter Mode : a ...

80,079 views 126 303
Read article

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