• Why Your Grand Total or Subtotal Isn't Working as Expected

    Tableau does not compute Subtotals and Grand Totals as just an aggregation (Sum, Avg, etc.) of the displayed marks. Instead, Subtotals and Grand Totals are computed as a separate calculation of the Measure at a coarse...
    Jonathan Drummey
    last modified by Jonathan Drummey
  • Testing Whether ATTR() Returns * (Multiple Values)

    Description: There are times when we want to know whether ATTR() is returning only one value or multiple values. ATTR() is a helper function that returns a value if there is one and only one value (and/or Null) of...
    Richard Leeke
    last modified by Richard Leeke
  • Datetime Bins

    Description: It is often useful to divide up the members of a datetime dimension into uniformly sized bins. Tableau has built-in support for doing this at the level of common datetime units, ranging from years to sec...
    Richard Leeke
    last modified by Richard Leeke
  • Continuous Bins

    Description:   It is often useful to bin numbers, and then plot on a continuous axis, or generally use as a continuous (green) pill. This enables adding a reference line.   Tableau has a bin option built i...
    Joe Mako
    last modified by Joe Mako
  • Replacing No Data with 0 or Another Value

    Description:   Often times there will be what looks like NULL data in the data, however, it really is No data. (Refer to the blank spaces in the below view).         Example Calculation: &...
    Jonathan Drummey
    last modified by Jonathan Drummey
  • Year to Date (YTD) from Previous Year and Fiscal Year

    Description:   While there is a Year to Date option in a Relative Filter for a date, there is no Year to Date from the previous year. The following formulas use the current Day/Month/Year to determine whether a ...
    Jonathan Drummey
    last modified by Jonathan Drummey
  • Convert String to Datetime (retaining fractional seconds)

    Description: Tableau's inbuilt conversion function for converting a string representation of a date and time to a datetime field is DATETIME(). This works fine as long as the precision of the time portion of the fiel...
    Richard Leeke
    last modified by Richard Leeke
  • Standard Rank

    Description:   This is a ranking function with ties. Tied items share the higher rank.         Example Calculation:     IF ISNULL(SUM([Sales])) THEN   NULL ELSE   II...
    Tracy Rodgers
    last modified by Tracy Rodgers
  • Floor and Ceiling Functions

    Description:   Tableau does not have native floor and ceiling functions. A floor function maps a number onto the largest previous integer (the biggest integer to the left), a simple ceiling function maps a numbe...
    Jonathan Drummey
    last modified by Jonathan Drummey
  • Most repeated value in data set

    i  have multiple cancellation tickets like 24hrs or 12 pm,Client  want the average to be across all rows but want to show only cancellation tickets  which occurs the most .  
    nagendra s
    last modified by nagendra s
  • Random Number Generation

    The following two calculations can be used to generate pseudo-random numbers in Tableau.  This works even when using extracts, unlike RAWSQL techniques.   The calculation is a table calc, so random values c...
    Joshua Milligan
    last modified by Joshua Milligan
  • Dynamic Spatial Binning

    Description:   Sometimes you have points on a map that you want to aggregate, but they don't fall into the state/city/zip hierarchy. This calc provides a way to dynamically bin/group points on a map. The size of...
    Daniel Leventhal
    last modified by Daniel Leventhal
  • DATEDIFF Semester

    Description:   How to calculate the semester difference between 2 dates       Example Calculation:   //# 1 - Using DATEDIFF INT(DATEDIFF('quarter',start date,end date)/2)     /...
    Americo Guazzelli
    last modified by Americo Guazzelli
  • Kaplan Meier Product Limit Estimator

    Description: The Kaplan Meier product limit estimator is widely used in survival analysis. It is applied in the situation where each event observation records, exclusively, either an outcome, or a censoring at a sing...
    Aaron Sheldon
    last modified by Aaron Sheldon
  • Quadrature (area under a curve)

    Description:   This calculation computes the area under the curve for a function f(x), using the Trapezoid Rule for a non-uniform grid.     Example Calculation:   //The below calculation will co...
    Tyler Martin
    last modified by Tyler Martin
  • Convert Epoch Format Timestamp to Datetime

    Description: Timestamps are often stored as a floating point number representing the number of days since an arbitrary date referred to as the epoch. The fractional portion of this number represents the time of day (...
    Richard Leeke
    last modified by Richard Leeke
  • Extract with "or" condition

    Description:   Here's a SQL that I wanted to replicate within Tableau using extract filters, but was unable to.   WHERE   (agg_dim_coordinate_filtered.time_type_code not in ('D', 'W', 'CW'))   OR ...
    Jeff Strauss
    last modified by Jeff Strauss
  • t-test of two independent means

    Description:   This is the simplest t-test for a significant difference in the means of two independent populations assumed to have equal variance. This test assumes the two samples are of equal size. The test i...
    Scott Tennican
    last modified by Scott Tennican
  • Reusable Z-Test for 1 or 2 Independent Means

    Description:   There has been a lot of discussion on the forums about getting basic statistical tests into Tableau.  With the assistance of a couple of other members, I was able to create a completely reusa...
    Brad Llewellyn
    last modified by Brad Llewellyn
  • Convert Hex String to Number

    Description: Tableau's built in functions do not include support for hex representations of numbers. This calculation converts a hex string to an integer. Example Calculation: Given a string of hex digits, first def...
    Richard Leeke
    last modified by Richard Leeke