Hi @Steven_Wang!

Thank you for bringing this to our attention. I do agree with you that the weighted average should be calculated by dividing by the sum of the weights. I have put in a request to update the documentation.

But to calculate the weight properly the LookML should look like this:

First get the weights

```
dimension: weight {
type: number
sql:
CASE
WHEN ${days_since_order} < 30 THEN 3
WHEN ${days_since_order} < 60 THEN 2
ELSE 1
END ;;
}
```

Next we calculate the weighted price:

```
dimension: weighted_price {
type: number
sql: ${sale_price} * ${weight} ;;
}
```

And finally we calculate the weighted average:

```
measure: weighted_average {
type: number
sql: sum(${weighted_price})/sum(${weight}) ;;
}
```

Please let us know if you have any other questions, cheers!