alphasqrd
alphasqrd

Reputation: 53

How do I remove text after a specific character in tableau?

I need to remove everything after a specific character in tableau. E.g.

xx.xxx.xxx.xxx will become xx.xxx, similarly if I have xxx.xxx.xx.xx it will become xxx.xxx. Basically I want to remove everything after the second ..

I have tried the below but it doesn't work.

IF CONTAINS([Dimension], '.') THEN
MID(
    [Dimension],
    FIND([Dimension],'.') + 1,
    FIND([Dimension],'.',2) - (FIND([Dimension],'.') +1)
)
END

I am getting Null when moving my calculated field in the rows part.

Upvotes: 1

Views: 2106

Answers (1)

Andy TAR Sols
Andy TAR Sols

Reputation: 1735

This formula should do it:

LEFT([Dimension], FINDNTH([Dimension],".",2)-1)

Upvotes: 2

Related Questions