2 Replies Latest reply on Nov 10, 2016 8:46 AM by Jan Paulsen

    Datediff calculation only working when date on level of detail shelf

    Jan Paulsen

      Hi all,

       

      I thought I understand table calculations, but I am stuck:/ I have the following filter: ATTR(if DATEDIFF('quarter',([Date]),({EXCLUDE [Date]:MAX([Date])}))<5 and DATEDIFF('quarter',([Date]),({EXCLUDE [Date]:MAX([Date])}))>0 then "Keep" ELSE "exclude" END). The filter will show you the last 4 quarters excluding the current quarter. The filter works, when I drag quarter to the level of detail shelf. Unfortunately, this will also split my sales figures.

       

      What I want, is the total of sales for "keep". But when I drag date off the level of detail shelf, I get no results:

       

      Is there a way to show the total sales for "keep"? And: what is the basic problem? Tableau cannot calculate max(date) without "seeing" date in the chart?

       

      I have also attached a simplified problem statement, hope this helps.

       

      Kind regards,

       

      Jan