cancel
Showing results for 
Search instead for 
Did you mean: 

Ordering Pivot Weekday column Mon-Sun

Laflet
9 - Travel Pro
9 - Travel Pro

I have a pivot table that is pivoting on a weekday column. How can I get this displaying in order Mon-Sun?

Currently, I have added a custom column “weekdayOrder“ as the first pivot column and a widget script. It kind of works, but I'm looking for a better solution.

Capture.PNG

Case 

when nm_day_of_week = ‘monday’ then ‘hidea’

when nm_day_of_week = ‘tuesday’ then ‘hideb’

when nm_day_of_week = ‘wednesday’ then ‘hidec’

when nm_day_of_week = ‘thursday’ then ‘hided’

when nm_day_of_week = ‘friday’ then ‘hidee’

when nm_day_of_week = ‘saturday’ then ‘hidef’

when nm_day_of_week = ‘sunday’ then ‘hideg’

END

 

 

and then added a script:

widget.on(‘ready’, function(se, ev){

$(“tbody tr” , element).not(‘.wrapper, .p-head-content’).each(function(){

var cell = $(this).children().last();

for (var a = 0; a < 7; a++){

cell = cell.prev();

var cell_value = cell.text()

if (cell_value.match(/hide.*/)) {

$(cell).css(“background-color”, ‘White’);

$(cell).css(“color”, ‘white’);

}

}

});

});

2 REPLIES 2

Angelina_QBeeQ
10 - ETL
10 - ETL

Hi @Laflet ,

You can add a field to the cube, in which you can add spaces before the names of the days.
They are not displayed on the visual, but the space will be in the first place when sorting in ascending order.
You can add two spaces and it will come before one space.
Add this column to the table and see the right order.
The result column will be like this:

'   monday'
'   tuesday'
'  wednesday'
' thursday'
'friday'
'saturday'
'sunday'

Always here to help,
Angelina from QBeeQ
[email protected]

Much better!! Thank you @Angelina_QBeeQ