How to add custom column name for aggregate column in table? #30010
Replies: 1 comment 2 replies
-
To add a custom column name for an aggregate column in a table chart with query mode Aggregate, specifically for a import AdhocMetric, { AGGREGATES, EXPRESSION_TYPES } from 'src/explore/components/controls/MetricControl/AdhocMetric';
const adhocMetric = new AdhocMetric({
column: { type: 'TEXT', column_name: 'State' },
aggregate: AGGREGATES.COUNT_DISTINCT,
hasCustomLabel: true,
label: 'Count of States',
});
console.log(adhocMetric.label); // Output: "Count of States"
console.log(adhocMetric.hasCustomLabel); // Output: true This code sets the custom label "Count of States" for the Additionally, in the Superset frontend, users can set custom labels for aggregate columns directly through the interface. This is indicated by the |
Beta Was this translation helpful? Give feedback.
-
I have a chart with type table, with query mode Aggregate. For this, I have 2 dimension columns and 1 metric, which is a COUNT_DISTINCT(State). When the chart displays to a user, the column header shows the same name, COUNT_DISTINCT(State).
Is there a way to provide a custom name for an aggregate column in this situation? For example, I'd like the column to display as "Count of States".
I went to edit the chart, and I don't see a way to give a custom label or column name. I checked both on the Data tab in the settings for the metric, and I tried under the Customize tab under the "Customize Columns" option for the column,
Is there a way to set up a custom name for the aggregate column in this situation, and if so please explain. Or if there's an alternative approach I can take to get this to work, let me know. Thank you.
Beta Was this translation helpful? Give feedback.
All reactions