While Tableau calculated fields in cube data sources cannot reference dimensions directly, table functions can reference dimension members in the view. For example, INDEX() can be used to reference the column/row of a dimension value in the view. Or WINDOW_SUM(SUM(1)) can be used to count the dimension members in the view.
Note: This method requires that all dimensions indirectly referenced in calculations are included in the view, but the view can be further modified to hide those dimensions. See Computing a Table Calculation by a Dimension Not Present in the View
The following instructions demonstrate how to create a Crosstab view with columns for 2019 sales, 2018 sales, and a column for the percent difference between those two years. To see these instructions in action (and see additional notes about why this method works), download the workbook from the right hand pane of this article.
As a workaround, create a calculated member instead. For more information, see How to Create a Calculated Member.
Cube data sources pre-aggregate measure values for the specified dimensions before the data is imported into Tableau Desktop. Therefore using dimensions in a calculation can potentially create inaccurate results.
To voice your support for the inclusion of this enhancement in a future product release, add your vote to the following Community Ideas:
Also see:
001458180
1170 KB

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.