Hi @cgreenacre ,
From your description, my understanding is that your raw data looks like this -
region, category, value
North America, a, 5
North America, b, 10
North America, c, 15
South America, a, 46
South America, b, 0
South America, c, 50
If this is incorrect, please provide an example of your raw table.
Based on the table above, to produce the example pivot table in your description -
Example data
region, col a, col b, col c, total, c as a % of total
North America, 5, 10, 15, 30, 50%
South America, 4, 46 0, 50, 8%
Pacific,1, 0, 0, 1, 0%
Africa, 0, 0, 19, 19, 100%
Total, 10, 56, 34, 100, 34%
- Add region as a dimension in visual
- Pivot the table by adding calculated fields for each of the categories-
- Add calculated field
a
with expression ifelse({category} = 'a') then {value} else 0
.
- Add calculated field
b
with expression ifelse({category} = 'b') then {value} else 0
.
- Add calculated field
c
with expression ifelse({category} = 'c') then {value} else 0
.
- Add
a
, b
, and c
to the visual individually. The default visual aggregation sum
should work in this case. Verify this gives you expected values.
- Adding {value} directly in visual using default aggregation
sum
should give you the total.
- Add calculated field percent of total with expression
sum({c}) / sum({value})
and add the field to the visual.
Please let me know if this works.
Thanks!