Forum Discussion

dani42's avatar
dani42
Regular Visitor
10 years ago
Solved

case weighting in data

Hello,   as I am working in market research, our data which is always a sample from the population, is often weighted (nearly always). In statistical programs such as SPSS, one can define a variabl...
  • dani42's avatar
    dani42
    9 years ago

    Okay, after a few trials and errors, and googling the DAX formulas, I might have worked it out. so in my case the formula I needed was, for displaying the average of a scale value (index value, ranging from 0 to 100):

     

    MyWeightedMeasure = SUMX('TableName'; 'TableName'[WeightColumnName] * 'TableName'[ColumnName]) / SUM('TableName'[WeightColumnName])

     

    I realized that this "workaround" was only necessary for displaying such an average value. For percentages, i.e. frequencies of groups that are represented by different names in one column, such as "male/female", you only need to put your column in the legend field, and your weight column in the value-field (I'm in the german version, I hope I translated the words correctly). But be careful, I think that only works right if your weights sum up to the total n of cases in your table.