7 Replies Latest reply on Apr 5, 2018 8:36 AM by Bradley Smith

# Tableau 10.3: SUM records after a true condition is met

Hi Team,

Trying to Sum values as a new field: New Occurrences but want to keep the record where field is true

Tried to do: Date of PDN = { FIXED [Associate]:max(if PDN= true then [Date] end )}<[Date] and then New Occurrences = IF MAX([Date of PDN]) = TRUE then SUM([Occurrences]) END but its only returning the Occurrence value of the records and not SUMMING them.

In the below example I want to keep 10/25/2017 record  and SUM the following records to 7

Any ideas of why? Eventually I am going to set SUM(New Occurrences) >= 3 to 'Y' Best Regards,

• ###### 1. Re: Tableau 10.3: SUM records after a true condition is met

You can compute the new occurrences with

MIN( {FIXED [Associate]: SUM(IF [Date of PDN] = TRUE then [Occurrences] END )} )

see on sheet 3

Michel

1 of 1 people found this helpful
• ###### 2. Re: Tableau 10.3: SUM records after a true condition is met

Awesome! Thanks Michel

Is there training that covers these types of advanced topics?

Best Regards,

• ###### 3. Re: Tableau 10.3: SUM records after a true condition is met

well , for a good reading on  lod expressions you can check

1 of 1 people found this helpful
• ###### 4. Re: Tableau 10.3: SUM records after a true condition is met

Thank you

• ###### 5. Re: Tableau 10.3: SUM records after a true condition is met

One final question,

If I am trying to SUM the # of 'Y' up to leader level and the organization level how come:

if [Action Required] = 'Y' then COUNTD([Associate]) END only returns Nulls and not a number?

• ###### 6. Re: Tableau 10.3: SUM records after a true condition is met

The MIN aggregation  on New Occurrences  was for the original view . With lod , you get a copy of the value for every row, so you don't want to SUM it.

But in your Action Required logic, you can use it without aggregation like if it was a dimension.

For this scenario, only use

{FIXED [Associate]: SUM(IF [Date of PDN] = TRUE then [Occurrences] END )}

Action Required will become

IF [New Occurences  (copy)] >= 3 Then 'Y'

ELSEIF [New Occurences  (copy)] >= 1 and [Event]= 'Final' Then 'Y'

ELSEIF [New Occurences  (copy)] >= 1 and[Event] = 'Final - New Hire' Then 'Y'

ELSEIF [New Occurences  (copy)] >= 1 and[Event] = 'Termination' Then 'Y'

END

and Distinct Associate becomes

COUNTD( if [Action Required (copy)] = 'Y' then [Associate] END )

1 of 1 people found this helpful
• ###### 7. Re: Tableau 10.3: SUM records after a true condition is met

Awesome much appreciated Michel