Skip to main content

Posts

Showing posts from November, 2020

Replace Text %20 with a space

Replace Text %20 with a space in Tableau There can be scenarios where the text contains %20 in place of spaces when the data is migrated from one database to the other. This usually happens in the column which contains text and ETL developers might not notice it. It can be corrected with a similar function in ETL tool however, the same simple function can be used in Tableau to achieve this using the Tableau in built function Replace. Syntax:  Replace("Text String dimension", 'characters to replace', " ") Example: Replace([Description Field], '%20', " ")

Replace missing or Null values

  Replace missing or Null values Option 1: Use ZN Select  Analysis  >  Create Calculated Field In the  Calculated Field  dialog box that opens, do the following, and then click  OK : Name the calculated field. In this example, the calculated field is named "Replace empty cells with zero (opt 1)" In the formula field, create a calculation similar to the following: ZN(SUM([Amount])) The ZN() function will replace any NULL values with zero Create a calculated field with a name like " Replace empty cells with last value (opt 1) " with a calculation similar to the following: IFNULL(     SUM([Amount]),     PREVIOUS_VALUE(0) ) IFNULL(..., PREVIOUS_VALUE(0)) will replace any NULL values with the last value of this calculation, which creates a running last value. Depending on how the view is built, it may be necessary to compute PREVIOUS_VALUE() differently. Replace [Amount] on Text on the Marks card with either [Replace empty cells with zero (opt 1)] or [Replace empty ce

Tableau Color indicator from previous day to today.

Tableau Color indicator to compare sales previous day to today. The calculation uses LOOKUP function to get the rate for previous day. (It is like Today's value - Previous days value)/Previous days absolute value. If the above > 0 then "Color1" Else If the above <0 then "Color2" IF (ZN(([Success Rate])) - LOOKUP(ZN(([Success Rate])), -1)) / ABS(LOOKUP(ZN(([Success Rate])), -1))=0 then "white" ELSEIF (ZN(([Success Rate])) - LOOKUP(ZN(([Success Rate])), -1)) / ABS(LOOKUP(ZN(([Success Rate])), -1))>0 then "green" ELSEIF (ZN(([Success Rate])) - LOOKUP(ZN(([Success Rate])), -1)) / ABS(LOOKUP(ZN(([Success Rate])), -1))<0 then "red" END