Hello everyone,
I have a dataset that is going through a series of calculations, but I struggle with adding the total for certain columns (determined by my user).
The easiest and most flexible way I can think of is appending the dataset to itself and adding 'Total' to fields to total.
I could hard code this by using the formula tool and union like below:

But I want to decide which fields to total by using another table.
Let's say i have the dataset below:
| fieldA | fieldB | fieldC | value |
| A | A | A | 0,21 |
| A | A | B | 0,15 |
| A | B | A | 0,31 |
| A | B | B | 0,45 |
| B | A | A | 0,55 |
| B | A | B | 0,65 |
| B | B | A | 0,41 |
| B | B | B | 0,25 |
And my user indicates that these are the two fields for which he wants the total
Basically I'd like a table that is three times as large as the original: the original table + the original table where fieldA = 'total' and the original table where fieldB = 'total'. It would look like the following:
| fieldA | fieldB | fieldC | value |
| A | A | A | 0,21 |
| A | A | B | 0,15 |
| A | B | A | 0,31 |
| A | B | B | 0,45 |
| B | A | A | 0,55 |
| B | A | B | 0,65 |
| B | B | A | 0,41 |
| B | B | B | 0,25 |
| Total | A | A | 0,21 |
| Total | A | B | 0,15 |
| Total | B | A | 0,31 |
| Total | B | B | 0,45 |
| Total | A | A | 0,55 |
| Total | A | B | 0,65 |
| Total | B | A | 0,41 |
| Total | B | B | 0,25 |
| A | Total | A | 0,21 |
| A | Total | B | 0,15 |
| A | Total | A | 0,31 |
| A | Total | B | 0,45 |
| B | Total | A | 0,55 |
| B | Total | B | 0,65 |
| B | Total | A | 0,41 |
| B | Total | B | 0,25 |
Does anyone have an idea how to proceed?
Thanks a bunch!
Mikis