6 Replies Latest reply on Mar 21, 2014 10:23 AM by Harold Hovagimian

    Data Source Conditional Filter by Formula

    Harold Hovagimian

      I created a calculated field which I can filter on but it is very slow.

       

      So I’m trying to write a data source filter to hopefully operate faster than the user filter but I’m not that good at Tableau programming and was hoping to get some guidance in the right direction. I was using this formula and then filtering all “NULL” values:

       

      IF LEN(TRIM([product])) = 17 AND RIGHT(TRIM([product]),3) = "-66" THEN "NULL"  // Product A Refurb

      ELSEIF LEN(TRIM([product])) = 17 AND LEFT(TRIM([product]),1) = "1" THEN "NULL" //Product R Refurb

      ELSEIF LEN(TRIM([product])) = 17 AND LEFT(TRIM([product]),1) = "6" THEN "NULL" //Product S Refurb

      ELSEIF LEN(TRIM([product])) <> 17 AND LEN(TRIM([product])) <> 14 THEN "NULL" //Remove non products

      ELSEIF FIND(TRIM([product]),"-") = 5 THEN "NULL"  //Remove parts

       

      ELSE TRIM([product])

      END

       

      But on the server side I can't use the formula as is and have to write it as a conditional. This is where I’m stuck at:

       

      LEN(TRIM([product])) = 14  //Keep Product A

      OR

      LEN(TRIM([product])) = 17 AND LEFT(TRIM([product]),1) <> "1" //Product R Refurb

      OR

      LEN(TRIM([product])) = 17 AND LEFT(TRIM([product]),1) <> "6" //Product S Refurb

      OR

      LEN(TRIM([product])) = 17 AND LEFT(TRIM([product]),1) <> "7" //AEDPlus and AEDPro Refurb

      OR

      LEN(TRIM([product])) = 17 AND FIND(TRIM([product]),"-") <> 5 //Remove parts

       

      Can anyone give me any help into what I’m doing wrong?