SumOver in a table and KPI


I have a dataset that looks like this :

ID Category Budget Day
1 man 5 01
1 man 5 02
1 woman 2 01
2 woman 6 01
2 woman 6 02

The budget is always the same for each (id, category) pair and I want to display it in a table, without summing duplicate values.
My output table should look like this :

ID Category Budget
1 man 5
1 woman 2
2 woman 6
Total 13

I managed to create this table with the formula : sumOver(max(budget), [id, category])

I also need a KPI displaying the total value (13), but creating a KPI with this calculated field gives me the following error : Table calculation attribute reference(s) are missing in field wells

Thank you for your help !

For POST_AGG table calculations, the partition(s) used in the calculation needs to be in the visual.

PRE_AGG should work in this case -
sum(maxOver(Budget, [ID, Category], PRE_AGG)/countOver(Budget, [ID, Category], PRE_AGG))



Simply you can try this sum(sumOver(max(budget), [id, category]))

@LexiL Thank you very much !
@Naveed This doesn’t work because of nested calculations