Pivot Table V2: Formatting specific columns and handling Nulls

I am migrating our legacy reporting grids to Pivot Table V2. I love the infinite scrolling performance, but I have two formatting hurdles:

  1. Null Handling: My dataset has sparse data. When a dimension is missing, the cell is blank. I want it to say “N/A”.
  2. Mixed Metric Formatting: I have Revenue (Currency) and Units (Integer) in the same pivot. How do I format them differently?

For Pivot Table V2, we introduced specific properties to handle these cases declaratively.

1. Handling Nulls: Use the showEmptyValuesAs setting.

.set('showEmptyValuesAs', 'N/A')

This applies globally to the grid cells that have no data.

2. Metric Formatting: The best practice is to define the format in the provider metadata, try:

var customMeta = {
    [source]: {
        fields: {
            'Revenue': { 
                'displayFormat': '($ 0.00 a)',
            }, 
            'Units': { 
                'displayFormat': '0',
            }
        }
    }
}
1 Like

I was very useful and it is working good, thanks for your help