4 Replies Latest reply on Aug 28, 2012 7:41 AM by Wolverine .

    Calling an aggregated function in a Calculated Field

    Wolverine .

      Comrades,

       

      I'm facing an issue while calling an aggregated user-defined function in a calculated field, and I'm hoping if some of you could shed some insight on it:

       

      Synopsis:

      I'm dealing with three categories of projects (Fixed, Subscription, Transaction), and I'm interested in calculating a compliance metric for each one of these categories. The formula for compliance is:

       

      For 'Subscription': [Revenue Submission Compliance]/[No. of Projects (Sub)]

      For 'Fixed' / 'Transaction': [Revenue Submission Compliance]/[No. of Projects]

       

      Issue:

      So, essentially my numerator in the two instances remains the same, while the denominator changes. Can I create a user defined function that distinguishes between the project class, and makes a decision based on the criterion? I'm guessing it something on the lines of an IF/ELSE statement, and I tried creating a Calculated field, but Tableau wouldn't let me call out an aggregated function (the one below).

       

      If ([Project Class]='Subscription') Then [Revenue Submission Compliance]/[No. of Projects (Sub)]

      Else [Revenue Submission Compliance]/[No. of Projects]

      End

       

      If there's a way we could call an aggregated function in Tableau, please let me know.

       

      Thanks for your time and help,