PercentOfTotal not returning correct result

Hi. I’m trying to calculate the Sales Contribution % for Trackable and Non-Trackable sales. The field used to identify trackable sales is called cash_tender_ind, with values 1 and 0, where 1 is non-trackable , and 0 is trackable.

The formula I used is percentOfTotal({Sales (Incl. VAT)}, [{cash_tender_ind}]), but when I visualize the data it shows 100% for both 1 and 0. Am I doing something incorrectly?


Hi @Danielle.jt12
percentoftotal is not working because it’s calculating the percentage of sales not relative to the overall total but relative to the total of the sales row and profile = 0 or profile = 1. That’s why it always comes out as 100%.
I suggest you either aggregate through custom SQL or work on the individual field for the percentage.
For example,
sumIf(sales, profile = 0)/sum(sales) > for the percentage of profile 0,
sumIf(sales, profile = 1)/sum(sales) >
for the percentage of profile 1.

@Danielle.jt12 ,

Checking in. We have not heard back from you regarding your question. We’d still like to help. If we do not hear back in the next 3 days, we will archive the question.