2 Replies Latest reply on Nov 6, 2018 3:29 AM by Zhouyi Zhang Branched to a new discussion.

    Create a calculated fields as result of logic operations

    Ward Emir

      Hi, I'm new to this so I'm sorry if the question is too simple. I'm wrapping my mind around something that I find really troubling to solve.

      I have a dimension [Purchase] which contains all purchases done by users for a given timeframe. The fields of interest for this dimension are 'first_purchase' and 'total_purchase'. I need to pull out a third that shows the purchases done by first time users.

      Say 'new_users_repurchase' and it should be defined with a simple rule such as "if 'first_purchase' is not null and 'total_purchase' is not null then 1 end"

       

       

      user_idFirst PurchaseTotal PurchaseNew Users Repurchase
      102319231231231
      1239128320
      1273738810

       

      I was trying to create calculated metrics for each of the fields and then combine to get the desired output on a new one from those as:

       

      CALCULATED METRICS

      [First Purchase] -> IF([Purchase]='first_purchase') THEN [Purchases] END

      [Total Purchase] -> IF([Purchase]='total_purchase') THEN [Purchases] END

      [New Users Repurchases] -> IF NOT ISNULL([First Purchase]) AND NOT ISNULL([Total Purchase]) THEN 1 END

       

      But when I try to combine the [First Purchase] and [Total Purchase] metrics they result is always 0.

       

      The goal is ultimately to display an aggregated view where I can see all [First Purchase], [Total Purchase] and [New Users Repurchase]

      First PurchaseTotal PurchaseNew Users Repurchase
      1242492499