cancel
Showing results for 
Search instead for 
Did you mean: 

Graying out rows in Pivot Table

amelia
10 - ETL
10 - ETL

Hi! I have a pivot table and would like to grey out some of the rows. These rows are for future weeks, or dates that are larger than the current week. I would rather grey out those rows instead of removing them, does anyone know how to do this? Thank you 🙂 

1 REPLY 1

harikm007
13 - Data Warehouse
13 - Data Warehouse

Hi @amelia ,

One solution is to change color of one column and spread the color using the script in this post: 

https://www.binextlevel.com/post/pivot2-spread-color-from-one-column-to-entire-row

 

In your case, use below script to change color of date column and apply the script from above post:

(Note: Below script is for Pivot2)

 

widget.transformPivot(
    {
        type: ['member']
    },
    function setCellBackground(metadata, cell) {
        
		columnIndex = 0 //index of date column in pivot
		
		if(metadata.colIndex == columnIndex && cell.value != 'Days in Date') //Update Date column title
		{
			
			
			if(new Date(cell.value) > new Date())
			{
				cell.style.backgroundColor = '#acadac';
			}
			
				
		}
		

    }
);

 

-Hari