'Sum of Rows and display in new column
As shown in the image I need to arrive at values displayed in C column:
In C column 1370311 value is arrived by adding A column from row 1 to 5 The second column is derived by adding A column from row 2 to 5 Similarly all values are computed.
I also need to compute values for rows 7 -10 using same logic,
How can I build a calculation the does this in tableau.

Thanks
Solution 1:[1]
What are the other dimensions of your data? You may be able to create a Calculated Field using an IF expression to aggregate on the dimension.
Solution 2:[2]
It seems like you have a monthly value (column A) and are trying to also display the year to date value (column C).
To do this you need to create a calculated field with an IF statement that basically explains to Tableau how to handle this data.
IF [some_parameter]=Jan AND [month]=Jan THEN sum([value])
ELSEIF [some_parameter]=Feb AND ([month]=Jan OR [month]=Feb) THEN sum([value])
ELSEIF [some_parameter]=Mar AND ([month]=Jan OR [month]=Feb OR [month]=Mar) THEN sum([value])
etc. all the way up to:
ELSEIF [some_parameter]=Dec AND ([month]=Jan OR [month]=Feb OR [month]=Mar OR [month]=Apr OR [month]=May OR [month]=Jun OR [month]=Jul OR [month]=Aug OR [month]=Sep OR [month]=Oct OR [month]=Nov OR [month]=Dec) THEN sum([value])
Basically this says, if it's January, only show me January. But if it's February then show me both January and February, etc. up to "if it's December, show me everything".
[some_parameter] doesn't necessarily need to be a parameter, it just needs to be whatever you are using to distinguish the rows. Some kind of field that will distinguish which if statement (which month) to use in the calculated field.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Smern |
