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: &... What ATTR() Does and Testing Whether ATTR() Returns * (Multiple Values) About ATTR(): ATTR() is a special Tableau function that effectively returns a record-level result as an aggregation. If there are multiple values of the record-level field in the current context then ATTR() will re... Rectangular Bins for Latitude and Longitude Description: It is sometimes useful to show high volume geographic data summarised into rectangular bins. This is tricky, though, because of the distortion caused by the map projection. Robert Morton provided... 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... 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 ... 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... 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... Quantile Description: Quantiles divide ordered data into a series of essentially equal-sized data subsets. The quantiles are the data values marking the boundaries between consecutive subsets. The most commonly used numbers o... Week Start on Monday Tableau Function(s) Used: DATEADD Example Calculation: DATEADD('day',-1,[Date Field]) Description: Tableau starts a week with Sunday. By using the above calculation, the start day ... 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... Template Description: Example Calculation: //calculation comments in green and in Courier New If [calculation] then [black] and [ Courier New font] end ... 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... Finding the Nth Highest Value Description: This calculation(s) uses parameters and table calculations to find the desired Nth value from a list. This example uses Superstore. It is important to note that the values are based on the Custome... 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 (... Convert Number to Hex String Description: Tableau's built in functions do not include support for hex representations of numbers. This calculation converts a positive integer to a hex string. Example Calculation: First define a calculated fie... 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... 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... Ordinal Suffix Description: Calculates the appropriate suffix for display of ordinal numbers (e.g. 1st, 2nd, 3rd, ...). This can improve readability when numbers are embedded in text such as headings, tooltips and annotatio... 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... 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...