cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member
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('');
 }
 })
 });
});
Comments
zach_myt
10 - ETL
10 - ETL

The previous link is broken. How can you get the latest date in a pivot? 

DRay
Community Team Member
Community Team Member

@zach_myt Sorry for the delay. Notifications for this users posts were not being monitored properly. The link has been fixed.

Version history
Last update:
‎02-14-2024 01:55 PM
Updated by:
Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Developers Group:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

The Legal Stuff

Have a question about the Sisense Community?

Email [email protected]

Share this page: