How do I create sum or total data in same column on dashboard?

Solved!
wtuntana
Level 2
How do I create sum or total data in same column on dashboard?
For example, I have this data set

Name Week1 Week2 Week3 Week4
A 10 20 30 40
B 41 31 21 11
C 3 4 5 6

I want the dashboard shows

Name Week1 Week2 Week3 Week4
โ€‹A 10 20 30 40
B 41 31 21 11
C 3 4 5 6
Total 54 55 56 57


or

Name Week1 Week2 Week3 Week4
โ€‹A 10 20 30 40
B 41 31 21 11
C 3 4 5 6
Total 54 55 56 57
--------------------------------------------------------
Grand total 222

Or modify the data table to use sum in the same column.



Thank you.
0 Kudos
1 Solution
cperdigou
Dataiker Alumni

With such a small table the easiest is to use a recipe to get the final table you want, then publish it to the dashboard.



Here is an example using only a visual prepare recipe, it involves transposing, computing the sum, then transposing back.



 





 



Another solution to only get the sums is to use a prepare recipe to Fold your data (the opposite of a pivot), then use a groupby "Week" to get the sums.

View solution in original post

3 Replies
cperdigou
Dataiker Alumni

With such a small table the easiest is to use a recipe to get the final table you want, then publish it to the dashboard.



Here is an example using only a visual prepare recipe, it involves transposing, computing the sum, then transposing back.



 





 



Another solution to only get the sums is to use a prepare recipe to Fold your data (the opposite of a pivot), then use a groupby "Week" to get the sums.

wtuntana
Level 2
Author
I see trans > sum > trans back > total.... nice idea

Thank you cperdigou.
0 Kudos
bencoffey
Dataiker Alumni

Also attaching a sample Python code recipe, which adds a sum value to an existing column. This would be another potential option to explore.