Contains filter equivalent in Tableau

假装没事ソ 提交于 2020-08-06 04:03:13

问题


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        

回答1:


  • 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. :)



来源:https://stackoverflow.com/questions/23635372/contains-filter-equivalent-in-tableau

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!