Forum Discussion

megm001's avatar
megm001
Advocate II
9 years ago

Defining a New Aggregate

Can I define a new aggregate?

 

For example, I'd like to weight my survey data, meaning I'd like to count each person's response as more or less than 1, depending on how accurately my sample represents the population. So, can I define a new aggregate, COUNTW, such that each person counts according to my weights column, w?

3 Replies

  • v-ljerr-msft's avatar
    v-ljerr-msft
    Microsoft Employee

    Hi megm001,

     

    Have you tried the suggestion provided by Phil_Seamark above? Does it work in your scenario?

     

    If you still have any question on this issue, feel free to post here? :smileyhappy:

     

    Regards

  • Phil_Seamark's avatar
    Phil_Seamark
    Microsoft Employee

    Hi megm001

     

    Why not create a new calculated column that contains a formula that determines the value and then simply SUM that.

    • megm001's avatar
      megm001
      Advocate II

      Thank you, Phil_Seamark

      Yes, that would work if I only wanted to count the number of responses for a given question (ie: count of respodents as the value). But what about something more complex, such as viewing spending across income levels by age group (ie: Line Chart where axis is income, legend is age group, values is spending)? In this case, how can I weigh the average spending? Manually, it would be sum of each respondent's spending multiplied by their corresponding weight, divided by the sum of the respondent's weights. (Σ(r_i(spending)*r_i(weight))/Σ(r_i(weight)), where r_i is each relevant respondent).

      In general, is there any way I can apply weights to all my data?