1 Reply Latest reply on Jun 28, 2016 1:45 PM by Yuriy Fal

    CALCULATING WEIGHTED MULTIPLE-CHOICE RESULTS

    Renan Faraon

      I'm using Tableau to generate visualizations from a survey with a lot of categorical variables. The problem is that I have several columns that actually are one variable, and I want the result to be a percentage based on the total of individuals and WEIGTHED -this have been a crucial issue for me .

      In other words, is something like working with a data from a multiple-choice question. But the content in the cells are the responses (and NOT 0 or 1).

      For example, columns like "Favourite Food 1", "Favourite Food 2" and "Favourite Food 3". And I want a result that it's a combination of these responses to just a single "Favourite Food".

       

      What I have  done so far:  In the dataset, selected the columns "Favourite Food 1","Favourite Food 2" ...  and click "Pivot".

      Then I selected "Pivot field names" -> "Create"-> "Group" and grouped "Favourite Food 1","Favourite Food 2" and "Favourite Food 3" into "Favourite Food".

      Then, I used the variable "Id"  - that's a different number for each individual - and use COUNTD([Id]) for the result of the percentage (it makes a plot with a list with all foods and the total of % is 100 or more). So far so good.

       

      The problem:  I want the result weigthed by a variable named "Weigth", with a Calculated Field like "COUNTD([Id])*[Weigth]", but Tableau wont let me. I already tryed a lot of combinations, such as SUM(countd([Id]*[Weight]) / TOTAL(SUM(countd([Id]*[Weight])).... I have no more ideas...Anyone with a suggestion or facing the same problem?

       

      Thanks,