4 Replies Latest reply on Aug 2, 2016 2:34 AM by Dilyana Suleymanova

# running total table calculation

HI there,

I have follow data set:

 wdem Date WDEM1111 01.04.2016 WDEM1111 01.04.2016 WDEM12111 01.04.2016 WDEM12111 01.04.2016 WDEM1311 01.04.2016 WDEM1511 01.04.2016 WDEM1111 01.05.2016 WDEM12111 01.05.2016 WDEM 1661 01.05.2016 WDEM1291 01.05.2016 WDEM6511 01.05.2016 WDEM3711 01.05.2016 WDEM1291 01.05.2016 WDEM6511 01.05.2016 WDEM3711 01.05.2016

I would like to calculate runing sum of unique  wdems per month. If I calculate  it on myself I have follow results:

April                                May

4 unique wdem               8 ( 4 unique wdem from april + 4 unique wdem from may  )

If I create running calculation in tableau I have follow results:

Tableau just prove all unique wdem per month and summarise numbers at the end. With the "Running_SUM"  Tableau cannot recognise already existing wdem from april in may.

Doese anybody have any idea which formula is correct for my calculation?

Thank u!

Best

Dilyana

• ###### 1. Re: running total table calculation

Howdy Dilyana,

This calculation will solve your Woes: COUNTD(IF {FIXED [Wdem]: MIN([Date])} = [Date] THEN [Wdem] END)

You can further apply a table calculation for a running total to this if you like.

The way it works is to first look at the interior portion: {FIXED [Wdem]: MIN([Date])}  This will look at every individual Wdem and return the first minimum date out of all their dates that they have data for. Then we compare that first date to each date in the database. If they are the same we return the Wdem number. This is repeated for each row in the database. So when you aggregate by day you use the COUNTD() function which will count all the distinct Wdems in existence for that day (and we only returned them if it was their first day). For more reading on LODs check out this blog http://interworks.co.uk/blog/tableau-level-detail-calculated-fields-v9/

Best Regards,

Carl Slifer

InterWorks

5 of 5 people found this helpful
• ###### 2. Re: running total table calculation

Hi Dilyana,

If you used Carl's logic then output will be as follows.

Please find the attached workbook for the same.

Thanks Carl, I learned something new today.

1 of 1 people found this helpful
• ###### 3. Re: running total table calculation

No problem Rohan, happy to help when I can.

On 2 August 2016 at 10:18, Rohan Malusare <tableaucommunity@tableau.com>

• ###### 4. Re: running total table calculation

Thank You, guys. It is really helpfull!