2 Replies Latest reply on Mar 7, 2016 9:45 AM by Imran Akbar

    modifying calculated field through Javascript API

    Imran Akbar

      I have built a cohort comparison tool in Tableau, where you can select some parameters for cohort 1 & cohort 2 and see all the metrics for each across multiple data sources.


      Problem is, of course, that the parameter won't allow me to multi-select.


      So I went and coded my own filters and UI in Javascript, and would like to send the "calculated field" definition to Tableau to render through the API.

      But I can't see any way to do this.


      The calculated field essentially allows me to define who goes into cohort 1, like so:


      IF [Country A]=[Country]

      AND [Product A]=[Product]

      AND [Date A Start] > [Date]

      THEN 1 ELSE 0 END


      What I'd like to do is change this so I can do something like:

      IF [Country A] IN ('USA','China')... etc. where the 'USA' and 'China' are provided to me by my Javascript code.


      Is there any way to do this?