12 Replies Latest reply on Aug 13, 2018 9:54 PM by Ritesh Bisht

    Combining IF statement with LOD expression

    Michiel Van Spaandonk

      Hi Tableau community,

       

      I am struggling to create a calculation that combines an IF statement with an LOD expression.

      I've looked through several posts on the forum, but can't find anything that works for me.

       

      I'm trying to analyse the new product sales, which we defined as:

      "The summed sales of the first 12 months a customer orders a new product"

       

      If a customer orders strawberries for the first time on January 20th 2017, his/her orders should count as new product sales until January 19th 2018.

       

      This is what I tried, but I can't get it to work.

      IF

      { FIXED [Customer], [Product] :

      (DATEDIFF('day', [First Order Product], [Ship Date]<365))

      }

      THEN "New Product sales" else "Not New Product sales" END

       

      I hope the attached workbook clarifies. Thanks!