Ordering Pivot Weekday column Mon-Sun
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.
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’);
}
}
});
});