cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Swap columns in pivot2

cw_meg01
7 - Data Storage
7 - Data Storage

Hi everyone.

I'm trying to find a way to order the columns of a pivot in ascending order, based on the number included in the description of the header. Below you'll find a screenshot with the content of the headers. The current order is "+150", "1-29", "120-149", "30-59", "60-89" and "90-119"; the last category ("90-119") is missing in the screenshot, but you get the idea. The correct order should be "1-29", "30-59", "60-89", "90-119", "120-149" and "+150".  One thing: notice the "+" in front of the "150" in the "+150" category. 

image pivot2 sort community.png

I'm open to any suggestions (e.g., doing a dom modification when the widget is ready.... or using any method from the Pivot2 API documentation), but, in any case, I would like to avoid the approach described in the following post https://support.sisense.com/kb/en/article/pivot2-table-row-custom-sort

Thanks in advance.

2 REPLIES 2

cw_meg01
7 - Data Storage
7 - Data Storage

Some more info... it's a pivot2 widget.

Angelina_QBeeQ
10 - ETL
10 - ETL

Hi @cw_meg01 ,
You can create a custom field for your column and add space symbol before text to change the order. Text sorting will sort space in the first order. You could add several spaces and it will sort the value with the most spaces first.
In your case, only 2 values are on the wrong places: '+150' and '120-149'.
The data in your new field will be like these:
        '  1-29' (2 spaces at the beginning), '  30-59' (2 spaces at the beginning), '  60-89' (2 spaces at the beginning), '  90-119' (2 spaces at the beginning), ' 120-149' (1 space at the beginning), '+150'(no space at the beginning).
Then use this column in the pivot.

Angelina_0-1658423167065.png