Latest Date In A Pivot
Question: How to see the latest date in the Pivot?
Solution: You need to change the date to an integer. Then I used the script in the comments in a previous post, and was able to request results.

This is the script we used
var m_names = new Array("Jan", "Feb", "Mar",
"Apr", "May", "Jun", "Jul", "Aug", "Sep",
"Oct", "Nov", "Dec");
var dateColumns = [4]; //select the date columns that should be transformed
var num = 0;
var selections = "";
widget.on('ready', function(se, ev){
$.each(dateColumns, function(index, value){
num = $("tbody tr:first").children().length - value;
var e = element;
var w = widget;
var d = dashboard;
$("tbody tr" , e).not('.wrapper, .p-head-content').each(function(){
var cell = $(this).children().last();
for (var a = 0; a < num; a++){
cell = cell.prev();
}
var num1 = parseFloat(cell.text().split(',').join(''));
var Year = Math.floor(num1/10000);
var Month = Math.floor(Math.floor(num1%10000)/100);
var Day = Math.floor(num1%100);
console.log(isNaN(Year));
if (!isNaN(Year)) {
var final_date = m_names[Month-1] +"-"+Day + "-" + Year;
cell.text(final_date);
} else {
cell.text('');
}
})
});
});
Updated 02-14-2024
intapiuser
Admin
Joined December 15, 2022