cancel
Showing results for 
Search instead for 
Did you mean: 

Financial Formatting for Pivot Tables on Linux

TriAnthony
Sisense Team Member
Sisense Team Member

Financial reports usually have specific styling requirements where negative numbers are shown in parentheses as opposed to having a leading minus sign. They are also usually written in red.  

The script below formats all the negative numbers in pivot tables exactly as the requirements above. Feel free to modify it if you have different formatting requirements.

 

// Format negative numbers
widget.transformPivot({ type: ['value'] }, function(metadata, cell) {
	
    if(cell.value >= 0 || !cell.value) {
        cell.content = cell.value;
		cell.contentType = 'html';

    } else
	{
	  	cell.content ='(' + (-1*cell.value).toString() + ')';
  		cell.style.color = 'red';
        cell.contentType = 'html'; 
    }
});

 

 

 

 

 

 

 

 

Tri Anthony Situmorang
2 REPLIES 2

szimmermann
8 - Cloud Apps
8 - Cloud Apps

Thanks!!!

IdoDarnell
8 - Cloud Apps
8 - Cloud Apps

Thanks for this @TriAnthony 

We also created a great Expandable Pivot plugin which is perfect for financial statements like P&L, Income statements and Balance sheets, and it too of course takes care of negative financial formatting,

Ido