Search code examples
data-visualizationtableau-apicalculated-fieldtableau-desktop

How to use ATTR with Fixed LOD Tableau or any workaround?


How to make the calculation below work.

{ FIXED [Call_Count]:IF ATTR([Date]) >= MIN([Date]) AND ATTR([Date]) <= MAX([Date])THEN COUNTD([Date]) END }

I just need to get the number of days starting the first occurrence date to the Latest date available or now().


Solution

  • I think we need clarification on what Call_Count is, and the table layout, but here's a stab at it:

    COUNTD(
     IF (
      [Date] >= { FIXED [Call_Count] : MIN([Date]) }
      AND [Date] <= { FIXED [Call_Count] : MAX([Date]) }
     ) THEN [Date]
     END
    )
    

    This will check if the current row's date is >= the min date of the call_count and the current row's date is <= the max date of the call count.

    However, I think that this would always be true? The date would have to be between the min and max?

    Maybe you're looking for something like this?

    DATEDIFF("day", { FIXED [Call_Count] : MIN([Date]) }, { FIXED [Call_Count] : MAX([Date]) })
    

    This would get you the days between the minimum and maximum for each call_count.