How to Create Customizable Table & Chart Builders

Often our goal is for Tableau to become a truly self-service tool—one where almost anyone in our organization can quickly connect to data and build a dashboard, chart, or report to answer business questions. And while that’s a great goal, it isn’t always possible. It’s difficult to train everyone to use Tableau and understand the data. And even those with good training can make mistakes. Fortunately, self-service can be more than just allowing people to build whatever they want from scratch. In many cases, we can build tools that allow users to get the data they need in a quick and flexible manner, while also lowering the barriers to entry and mitigating the possibility of mistakes. One such way I’ve done this in the past is to create Table & Chart Builders. These are tools, built in Tableau, that allow users to select the dimensions and measures they wish to use, then build either a highlight table, bar chart, or trend chart. This gives users a quick, easy, and powerful way to get answers to many different questions. The animation below gives you a quick idea of what I mean.

 

 

In this blog, I’m going to share my approach to building these.

 

Highlight Table Builder

We’ll start with a highlight table builder. Our first step is to create multiple parameters with a list of potential dimensions the user can select. These can be dimensions in the data set, calculated fields, groups, etc. For example:

 

 

We want to give our users the ability to group their table by up to five different dimensions, so we’ll create five copies of this parameters. Of course, users won’t always want to use all five, so we’ll included a “None” option in the parameter.

 

We then create a calculated field—one for each parameter—that returns the value of the specified dimension.

 

Field 1

// Field value based on the parameter.

CASE [Field 1 Parameter]

WHEN 'None' THEN ''

WHEN 'Category' THEN [Category]

WHEN 'City' THEN [City]

WHEN 'Country' THEN [Country/Region]

WHEN 'Customer ID' THEN [Customer ID]

WHEN 'Customer Name' THEN [Customer Name]

WHEN 'Order Year' THEN STR([Order Year])

WHEN 'Region' THEN [Region]

WHEN 'Segment' THEN [Segment]

WHEN 'Ship Mode' THEN [Ship Mode]

WHEN 'State' THEN [State/Province]

WHEN 'Sub-Category' THEN [Sub-Category]

END

 

We then build a highlight table using these fields and any measures we might want to include.

 

 

Note: If desired, you can make it so that your users can choose the measures themselves. For some tips on this, see 5 Ways to Filter a List of Measures.

 

I personally prefer the ability to sort each row across the entire table individually, rather than the default nested sorting (e.g. the example above will sort within each country). So we’ll use trick # 3 from 8 Random Tableau Tips and create a calculated field to act as a unique ID for each row.

 

Table Unique ID

// Unique ID so the table is sortable.

[Field 1] + '|' + [Field 2] + '|' + [Field 3] + '|' + [Field 4] + '|' + [Field 5]

 

We’ll add this as the first pill on Rows, then right-click it and deselect “Show Header”. With this in place, the nesting disappears and every row will sort individually, just like Excel.

 

 

Next, we’ll add this to a dashboard and display the parameters on top of the dimension column headers. Our users can now select from the dropdowns to group and aggregate their data however they like. And they can also sort the measures as desired.

 

 

Bar Chart Builder

The bar chart builder will be similar to the table builder, but instead of multiple measures, we’ll only show one measure. The user will be able to select which measure, how to aggregate it, and how to sort. We’ll use all the parameters and calculated fields used for the table builder, but we’ll create a few more.

 

We’ll start off by creating three parameters to allow us to choose 1) The Measure we’ll display, 2) How to Aggregate that Measure, and 3) How to Sort the Bar Chart.

 

 

 

 

And we’ll create several new calculated fields:

 

Measure Non-Aggregated

// Select the measure based on the selected parameter value.

CASE [Measure Parameter]

WHEN 'Sales' THEN [Sales]

WHEN 'Profit' THEN [Profit]

WHEN 'Quantity' THEN [Quantity]

END

 

Measure Aggregated

// Aggregate the measure based on the selected aggregation.

CASE [Aggregation]

WHEN 'Sum' THEN SUM([Measure Non-Aggregated])

WHEN 'Average' THEN AVG([Measure Non-Aggregated])

WHEN 'Median' THEN MEDIAN([Measure Non-Aggregated])

WHEN 'Min' THEN MIN([Measure Non-Aggregated])

WHEN 'Max' THEN MAX([Measure Non-Aggregated])

END

 

Sort Field

// How is this supposed to be sorted.

CASE [Sort By]

WHEN 'Alphabetical' THEN NULL

WHEN 'Measure Descending' THEN -ZN([Measure Aggregated])

WHEN 'Measure Ascending' THEN ZN([Measure Aggregated])

END

 

We’ll drop Measure Aggregated on the Columns shelf and we’ll sort Table Unique ID using the Sort Field. Then, we add everything to a dashboard just like the table builder.

 

 

Trend Chart Builder

The final chart builder is a trend chart. This can be either a line chart or a vertical bar chart. I prefer the bars for this use case, so that’s what we’ll do here. Like the bar chart, users will be able to select all the groupings, the measure, its aggregation, and its sorting method. But this chart will show trends over time, so we’ll need some dates. We could create our chart using a static date level such as month or quarter, but I prefer to make this a flexible option as well. So, we’ll create one more parameter that allows users to select the date period.

 

 

Then we’ll create a calculated field that truncates the date based on the selected date period.

 

Display Date

// Date to display on the chart, based on selected period.

DATE(

    CASE [Date Period]

    WHEN 'Day' THEN DATETRUNC('day', [Order Date])

    WHEN 'Week' THEN DATETRUNC('week', [Order Date])

    WHEN 'Month' THEN DATETRUNC('month', [Order Date])

    WHEN 'Quarter' THEN DATETRUNC('quarter', [Order Date])

    WHEN 'Year' THEN DATETRUNC('year', [Order Date])

    END

)

 

Note: We could simplify this by updating the parameter to use lower case text, then use that parameter directly in the DATETRUNC calculated field, eliminating the CASE statement altogether.

 

We’ll use Display Date on the Columns shelf and Measure Aggregated on Rows.

 

 

One issue with this is that the bar width will create problems when you change the date period because it will always be a static width. Bars will be too skinny for larger date periods and they’ll be too large, causing overlap, for smaller periods. To address this, we’ll create one final calculated field for the bar size.

 

Bar Width

// Set bar width based on the selected date level.

CASE [Date Period]

WHEN 'Day' THEN 0.5

WHEN 'Week' THEN 5

WHEN 'Month' THEN 25

WHEN 'Quarter' THEN 75

WHEN 'Year' THEN 300

END

 

Note: These widths are designed to leave a little bit of space in between bars.

 

We then drop this field onto the size card.

 

Finally, we add everything to a dashboard.

 

 

Wrap Up

The last thing we do is to add some navigation to each dashboard so we can jump from one chart builder to another, add some filters, and add a crosstab download button. We now have a user-friendly tool that almost anyone can use to answer any number of questions about the data.

 

If you’d like to check out my sample workbook, you can find it on Tableau Public: Table & Chart Builders. Thanks so much for reading!

 

Ken Flerlage, October 14, 2025

Twitter | LinkedIn | GitHub | Tableau Public


No comments:

Powered by Blogger.