I use the following statement to create a percentage calculation in a view:
round(((Surveys
.RejectedAsAdvertising
/ Surveys
.Responses
) * 100),0) AS PercentageAdvertising
Basically, I divide the number of responses to a certain question (in this case, is something considered to be advertising) by the total number of responses.
In the end, I have columns that show percentages for each of five possible survey responses ("Is it advertising?", "Is it boring?", etc.).
This works perfectly but there s one thing I d like to tweak. When a response type (e.g., advertising) does not have any votes, my calculated field receives a NULL value.
When defining my view, how can I specify a default value of 0?
Thanks.