1 Reply Latest reply on Jun 28, 2012 4:59 AM by Shawn Wallwork

    Using YEAR Function

    Ben Shirley

      Hi All,


      Still new to this so here is what im trying to get:


      IF YEAR(#TODAY()#) THEN (DATEDIFF('day',[Date Asset Requested],[Assets Shipped]) ) END


      The DATEDIFF Calculation works just fine, What i wanted to do with it was apply a live filter over the top to generate a range so that it was not reporting on the whole document just the date range,


      The Doc is 3 years deep but i wanted to limit it to reporting to year 2012, then i wanted to use the same rule but limit it to a range of 7 Days, I dont want user input, so i thought using the TODAY function would be good, such as from today report on last 7 days, OR for the year, Report for the year on whatever year today is present within..


      but i dont know how to mix and layer functions within Tableau..




        • 1. Re: Using YEAR Function
          Shawn Wallwork

          Hey Ben, a couple of things. First the syntax, you don't need the # signs. Second you haven't written an expression to test in the first part of your IF statement. Try something like this:


          IF YEAR(TODAY())=YEAR([Order Date]) THEN (DATEDIFF('day',[Order Date],[Ship Date]) ) END


          (Paste it in the Superstore Data to see how it works.)



          1 of 1 people found this helpful