質問

I am Tableau Noob and wondering if there is way to filter data based on part of string?

Name    Details1    Details2    Details3    Tag
Luffy   xxxx        xxxx        xxxx        Flag1|Flag2
Zorro   YYYY        YYYY        YYYY        Flag2|Flag3|Flag4.
Ussop   ZZZ         ZZZ         ZZZZ        Flag1|Flag5
Nami    RRR         RRR         RRRR        Flag3|Flag6
Brook   QQQQ        WWW         QQQQ        Flag4|Flag7
Robin   OOOO        OOOO        OOOO        Flag3|flag8
Franky  FFFF        FFFF        FFFf        Flag1|Flag9

So basically for the data shown above,I want to create filter, kind of equivalent of contains filter in excel.

For example if "contains" filter select flag5 only following Name and details should be displayed which contain Flag5 substring in Tag variable.

Name    Details1    Details2    Details3
Ussop   ZZZ         ZZZ         ZZZZ        
役に立ちましたか?

解決

  • Create a string list parameter that contains all of the possible flag values (this is mildly tedious and can take a while if there are a lot of flags. It's usually better to populate this from an existing field or data column)

Filter Parameter definition

  • Right-click on the parameter and click "Show Parameter Control"

  • Create a calculated field as per the following formula:

    CONTAINS([Tag], [FilterParameter])

  • Drag the calculated field on to the filters card, and check the "True" box so that only rows that fulfil the formula above are displayed

Flag Filter on Filters shelf

  • Changing the value of the parameter control should then filter the rows as per the requirement

If you have any issues let me know, as I can give you the workbook that I used to test all of this out. :)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top