Forum Discussion
Weighting survey data
Hi,
I am working with survey data where there are numerous questions answered(numeric) by respondents. I also have weight given in the file for each respondent. How can I apply that weight to weigh up or down the response ? I know this can be done in Q or SPSS, but not sure how to do it in power BI. Some inputs are binary while few are ordinal. Data looks like this:
2 Replies
- Ritaf1983Super User
Hi niranjanm45
If I understood you in the right way, you can use sumx function, something like
Weighted measure = sumx(your table,[score column]*[nweight])if it is something else,
please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
- niranjanm45Frequent Visitor
Hi Ritaf1983 ,
Thanks for your response. The data has binary inputs (Yes, 1 and No,0) and in some cases, ordinal inputs (1-5). The weight column has been calculated using the age group gender and state. So, just multplying the weight column would not be the correct way I feel. Attaching the data for reference:
QS1A State Regional QS2 QS2r99 QS2A xQS3 QS3 nweight 6 4 1 27 0 3 1 1 1.36145 9 5 2 57 0 6 2 2 1.2848 12 7 1 68 0 7 1 1 0.566402 12 7 1 34 0 3 1 1 0.8833 14 8 1 34 0 3 2 2 0.792434 9 5 2 24 0 2 2 2 1.115278 7 4 2 56 0 6 2 2 0.708307 2 2 1 39 0 4 2 2 1.217883 14 8 1 69 0 7 2 2 0.669167 2 2 1 49 0 5 1 1 1.444613 12 7 1 64 0 6 1 1 1.347893 12 7 1 58 0 6 1 1 1.347893 12 7 1 32 0 3 2 2 0.610411 8 5 1 27 0 3 2 2 0.7227 6 4 1 49 0 5 2 2 1.067625