I have a table, and I want one column to show a running total on each line, i.e., it has to show the total of the values of another column up to that row. I thought about accumulating the total into a length variable (the numbers are floating point) and use a command to add values to it.

So, when I used to use a longtable (not longtabu) for the table, it looked fine. Here's the example that worked correctly:

```
\documentclass[11pt,a4paper]{article}
\usepackage{tabu}
\usepackage{longtable}

\newlength\yyy
\setlength{\yyy}{0pt}
\newcommand{\yy}[1]{#1\global\addtolength{\yyy}{#1pt}\relax}

\begin{document}
\the\yyy
\begin{longtable}{l|r|r}
ID & Amount & Total\endhead
a & \yy{100} & \the\yyy\\
b & \yy{100} & \the\yyy\\
c & \yy{100} & \the\yyy
\end{longtable}

\end{document}

```

and its output (ignore the "pt", I haven't stripped it yet in this MWE):
![Correct result](https://i.stack.imgur.com/uDGqX.png)
However, if I use longtabu (which I *need* to use for other reasons), the values in the third column start from 700. Here's the example that bugs:

```
\documentclass[11pt,a4paper]{article}
\usepackage{tabu}
\usepackage{longtable}

\newlength\yyy
\setlength{\yyy}{0pt}
\newcommand{\yy}[1]{#1\global\addtolength{\yyy}{#1pt}\relax}

\begin{document}
\the\yyy
\begin{longtabu} to \textwidth {X[l]X[r]X[r]}
ID & Amount & Total\endhead
a & \yy{100} & \the\yyy\\
b & \yy{100} & \the\yyy\\
c & \yy{100} & \the\yyy
\end{longtabu}

\end{document}

```

and the output I get:
![Result not working](https://i.stack.imgur.com/0y1p6.png)

Any idea of why this behaviour comes up?
Thanks in advance.