How to Align Text Displayed in a Dual Axis Measure Column

Published: 15 Dec 2023
Last Modified Date: 18 Dec 2023


Text is center-aligned in a dual axis measure column. For numerical values, how can we right-align the text?
Note: Dual axis measure column is used when conditionally formatting cell background color as in Example 2 of this article, for example.

User-added image


  • Tableau Desktop


When placing text in a dual axis measure column, the text is centered on the axis zero line as follows.
User-added image

If the numeric values need to be right-aligned, it is possible to make them appear right-aligned by adding a blank spaces to the text prefix and adjusting the axis range.
User-added image

Follow along in the sample packaged workbook found in the Attachments section to right-align text displayed in a dual axis measure column. In our example, the following data is used.

User-added image

1. Create a calculated field and name it Container.
2. Create a calculated field and name it Sales (length-adjusted).
Note: To unify the length of numerical text, blank spaces are added to the text prefix using the SPACE function. Minor adjustments are necessary depending on your actual length of the numerical text.
IF LEN(STR(SUM([Sales]))) = 1 THEN
3. Add ID and Product to Rows.
4. Add two SUM(Container) to Columns.
5. Right-click the second SUM(Container) in Columns and select Dual Axis.
6. Click the left SUM(Sales) in Columns. Then, SUM(Container) marks card will be opened.
7. Change the marks type to Text.
8. Add Sales (length-adjusted) to Text in the SUM(Container) marks card.
9. Click the right SUM(Sales) in Columns. Then, SUM(Container)(2) marks card will be opened.
10. Change the marks type to Square.
11. Add a field used to determine the color of the cells to Color. In our example, add SUM(Sales) to Color.
Note: Adjust the width of the view, the size of Square, the color opacity, etc, as you need.
12. Right-click the top header and select Edit Axis. Configure it as follows.
 User-added image User-added image
13. Right-click the bottom header and select Edit Axis. Configure it as follows.
Note: Adjust the axis range to make the text appear right-aligned.
 User-added image User-added image
14. Right-click the top header and select Format. Change the Borders and the Lines format as follows.
 User-added image
15. Adjust the height of the headers and rows.
 User-added image
Did this article resolve the issue?