Video | Tableau | Data prep | Analytics

The MID Function in Tableau.

This one caught me out in a certification exam, so I made a video about MID before I could forget it again.

Part ofTableau Functions
  • MID() returns characters from a string starting at a specified position, with an optional second argument controlling how many characters to return
  • Choosing position 2 effectively drops the first character; the start position is treated as character one for the length count
  • For neatly structured data, LEFT or RIGHT functions are usually simpler than MID
  • Wrapping FIND() inside MID() lets you dynamically locate a character, such as finding the position of an @ sign
  • Adding +1 to a FIND() result lets you start MID one character past the matched character, useful for extracting an email domain

The mid function in Tableau returns the string starting at index position start. The first character in the string is position 1. If the optional argument length is added, the returned string includes only that number of characters.