Last Modified Date: 18 Oct 2022
Environment
Tableau DesktopResolution
Option 1
Move the IF statement inside the aggregation. For example:- The following calculation: IF MIN( [Region] ) = "Central" THEN SUM( [Sales] ) END
- Would become: SUM( IF [Region] = "Central" THEN [Sales] END )
Option 2
Add the dimension from the condition to the view. For example:- In the following calculation: IF MIN( [Region] ) = "Central" THEN SUM( [Sales] ) END
- The only conditional statement (aka statement that returns either true or false) is MIN( [Region] ) = "Central". Therefore we would want to add [Region] to the view.
Cause
MIN( [Region] ) is calculated for every partition (e.g. bar, circle, cell, etc...) in the view. When [Region] is not in the view, then every partition may have multiple values of [Region], but MIN( [Region] ) will only return the minimum of all of the values of [Region] in that partition.For example, if a particular customer does business in multiple regions, but the first region in the list is "Central" then MIN( [Region] ) = "Central" will be true for all transactions from that customer, and all sales will be returned.
Notes
- For data blending, option 1 may be possible if all fields are from the same data source
- If option 2 is the only possible solution, but the final view should not show the extra dimension then option 2 in Computing a Table Calculation by a Dimension Not Present in the View can be used to hide the extra dimension.
Additional Information
Calculated Field Returns Null ResultsThank you for providing your feedback on the effectiveness of the article.
Open new Case
Continue Searching
Knowledge Base
Community
Product Help
Training and Tutorials