How to custom pivot table header width

How to custom pivot table header width?
Which CloudFormation properties should I set?

Hi @shinya.sakae ,

in web you can only the widht for all columns.
grafik

Via API you could change “ColumnSpan” for each column.

BG

1 Like

Hi @ErikG!
Thanks to reply.
Sorry, My explanation was incorrect.
I would like to adjust the header width in CloudFormation.
(I would like to adjust the width of the leftmost DATE in the attached image.)

Hi @shinya.sakae,
Did you check,

there is a parameter "DefaultCellWidth"
BG

Hi @ErikG .

there is a parameter "DefaultCellWidth"

I tried it, but only the Column width was updated, not the Header width.

can you share the current table?

Hi @ErikG .
The current table has only the US, EMEA, and APAC column widths adjusted from the table shared in the first post.

And you want the “Total” column as well?

@ErikG
Yes, I want to adjust the width of the “Total” column only.

Mh ok. Sorry but then i’m lost, too.

Hello @shinya.sakae .

We will need a bit of clarification of what you are trying to achieve in order to be able to better help you.

My understanding is that you want to make your first column wider (or to set a particular width), so basically you want to go from this:

To this (or similar):

If that’s the case there is an option you can use in the dashboard definition object in CloudFormation to set this column with, this option is via DataPath.

Basically the setting that you need to set is the one I point out below:

{
                        "PivotTableVisual": {
                            "VisualId": "b969dfac-df9d-4e35-b315-9c3082f03d95_798dc445-0fc0-4544-a6d7-b68e4a1b6d55",
                            "Title": {
                                "Visibility": "VISIBLE",
                                "FormatText": {
                                    "PlainText": "Number of Product by Segment"
                                }
                            },
                            "Subtitle": {
                                "Visibility": "VISIBLE"
                            },
                            "ChartConfiguration": {
                                "FieldWells": {
                                    "PivotTableAggregatedFieldWells": {
                                        "Rows": [
                                            {
                                                "DateDimensionField": {
                                                    "FieldId": "b76ca1c1-e5d4-4330-a753-8d423fa492c9.Order Date.2.1701255017629",
                                                    "Column": {
                                                        "DataSetIdentifier": "SaaS-Sales (1).csv",
                                                        "ColumnName": "Order Date"
                                                    },
                                                    "DateGranularity": "MONTH"
                                                }
                                            }
                                        ],
                                        "Columns": [
                                            {
                                                "CategoricalDimensionField": {
                                                    "FieldId": "b76ca1c1-e5d4-4330-a753-8d423fa492c9.Region.2.1701255076569",
                                                    "Column": {
                                                        "DataSetIdentifier": "SaaS-Sales (1).csv",
                                                        "ColumnName": "Region"
                                                    }
                                                }
                                            }
                                        ],
                                        "Values": [
                                            {
                                                "NumericalMeasureField": {
                                                    "FieldId": "b76ca1c1-e5d4-4330-a753-8d423fa492c9.Sales.2.1701255065600",
                                                    "Column": {
                                                        "DataSetIdentifier": "SaaS-Sales (1).csv",
                                                        "ColumnName": "Sales"
                                                    },
                                                    "AggregationFunction": {
                                                        "SimpleNumericalAggregation": "SUM"
                                                    }
                                                }
                                            }
                                        ]
                                    }
                                },
                                "SortConfiguration": {
                                    "FieldSortOptions": []
                                },
                                "TableOptions": {
                                    "ColumnHeaderStyle": {},
                                    "CellStyle": {},
                                    "RowAlternateColorOptions": {
                                        "Status": "DISABLED",
                                        "UsePrimaryBackgroundColor": "ENABLED"
                                    },
                                    "RowsLayout": "HIERARCHY",
                                    "DefaultCellWidth": "100px"
                                },
                                "TotalOptions": {
                                    "RowSubtotalOptions": {
                                        "TotalsVisibility": "VISIBLE",
                                        "CustomLabel": "<<$aws:subtotalDimension>> Subtotal",
                                        "TotalCellStyle": {},
                                        "ValueCellStyle": {},
                                        "MetricHeaderCellStyle": {},
                                        "StyleTargets": [
                                            {
                                                "CellType": "VALUE"
                                            },
                                            {
                                                "CellType": "TOTAL"
                                            },
                                            {
                                                "CellType": "METRIC_HEADER"
                                            }
                                        ]
                                    },
                                    "RowTotalOptions": {
                                        "TotalsVisibility": "VISIBLE",
                                        "Placement": "START"
                                    }
                                },
                                "FieldOptions": {
                                    "SelectedFieldOptions": [
                                        {
                                            "FieldId": "b76ca1c1-e5d4-4330-a753-8d423fa492c9.Order Date.2.1701255017629",
                                            "Visibility": "VISIBLE"
                                        },
                                        {
                                            "FieldId": "b76ca1c1-e5d4-4330-a753-8d423fa492c9.Region.2.1701255076569",
                                            "Visibility": "VISIBLE"
                                        },
                                        {
                                            "FieldId": "b76ca1c1-e5d4-4330-a753-8d423fa492c9.Sales.2.1701255065600",
                                            "Visibility": "VISIBLE"
                                        }
                                    ],
                                    "DataPathOptions": [
                                        {
                                            "DataPathList": [
                                                {
                                                    "DataPathType": {
                                                        "PivotTableDataPathType": "HIERARCHY_ROWS_LAYOUT_COLUMN"
                                                    }
                                                }
                                            ],
                                           "Width": "52px"
                                        }
                                    ]
                                }
                            },
                            "Actions": []
                        }
                    }

The Width property (PivotTableVisual.ChartConfiguration.FieldOptions.DataPathOptionsWidth) property that you see below on the last lines is the one that sets the with for the first column (date column).

As a result I see my pivot table like this:

Hope it helps, please mark this solution as solved if that’s the case also to help other members of the community., otherwise let us know.

Thank you for posting into the QS community!

1 Like

Hello @shinya.sakae !

Was @ErikG or @EnriqueS 's comments helpful in finding a resolution for this problem and if so could you mark their posts as a solution?

We have not heard from you in some time but would still like to help find a solution. If we do not hear from you in 3 days this post will be archived.

1 Like

@EnriqueS cc: @duncan @ErikG
Thanks to reply !
Setting HIERARCHY_ROWS_LAYOUT_COLUMN to DataPathType.PivotTableDataPathType succeeded!
I’m going to mark this post as resolved.

1 Like