Using string value in the calculation

Hey Community,

To begin with I am new to Quicksight and I have a dataset which I am not able to determine (the correct syntax and hence the calculation). Based on the figure below I am trying to calculate the

  • Sum of all the a’s / sum of all the b’s * 100 to get the percentage value.

This is what I am putting in the calculated field: sum({metric_name}=['a'])/sum({metric_name}=['b']) / 100 But there is always an error showing up

Problem: I am unable to use the value ‘a’ in the calculated field.

Note: Is it possible to do it or we need to have separate columns for a,b,c, individually?

Can someone please help me out here.

image

have you tried sum(ifelse({metric_name}=‘a’,{sum},0)/sum(ifelse{metric_name}=‘b’,{sum},0) * 100

1 Like

Hey thanks a lot for your reply!! There were some syntax errors in the solution provided but it helped to make it better and I found the solution.

1 Like

my eyes don’t see missing )'s any more

  • [ ] brackets are not needed

  • ,sum,0 part after ‘a’ was missing

So in short the ifelse syntax was not complete but it actually helped me understand this sysntax :wink:

Thanks for the help though appreciate the effort!!

1 Like