4 Replies Latest reply on Aug 23, 2018 11:42 PM by Zhouyi Zhang

# Grouping in Calculation

Hi All,

Below is my data. I need to take the max date for an ID and the amount in that row.

For example- for "aa" ID 16-03-2018 and "7" amount should come.

Presently when i am doing it in Tableau. for "aa" ID I am getting max date but the amount is coming as SUM even though only MAX date is showing up for the ID thus for aa it is showing-  18(5+6+7) and 16-03-2018 as date.

How can we do this? Kindly advise.

Appreciate you help

 ID Amount Date aa 5 14-03-2018 aa 6 15-03-2018 aa 7 16-03-2018 bb 8 17-03-2018 bb 9 18-03-2018 cc 11 19-03-2018 cc 12 20-03-2018 cc 13 21-03-2018
• ###### 1. Re: Grouping in Calculation

Hi, Raman

Below is the screenshot of calculation fields and result

Hope this helps

ZZ

• ###### 2. Re: Grouping in Calculation

Hi Raman,

You can try below approach:

1. min date = {FIXED [ID]: min([Date])}

2.  amount for min date=  if [Date]=[min date] then [Amount] END

• ###### 3. Re: Grouping in Calculation

Thanks Zhouyi, Solves what I need.

• ###### 4. Re: Grouping in Calculation

No worries, I am glad to help

ZZ