1vote

Counting Stars?

I have a database of applicants and three views that allow reviewers to rate them from ⭐ to ⭐⭐⭐⭐⭐. I want to create a formula field that captures their average rating. I can use .length() but I'm wondering if there are other approaches that might work.

Not everyone has rated every applicant so 0 stars doesn't mean that the applicant is a zero, just that the reviewer hasn't gotten to them yet. I'm also not sure how to account for that.

3 Answers

0vote

polle Points102630

A simple if 0 = No reviews yet in your Notion formula makes the trick.

0vote

amandabee commented

Here's what I'm getting:

Σ Reviewer 1 Reviewer 2 Reviewer 3 Goal
2.3 ⭐⭐⭐ ⭐⭐⭐⭐ mean(3,4)
0.7 mean(1,1)
1.3 ⭐⭐⭐ mean(1,3)
3 ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐ mean(5,4)

I'd like to find the mean of scores that have been given, which would be 3.5 for row 1 mean(3,4) instead of 2.3 which is mean(3, 0, 4).

0vote

Imrul Points180

use conditional logic to include only the values that exist. For example, if you have three reviewer fields (Reviewer 1, Reviewer 2, Reviewer 3), you can use this formula:

(
  if(prop("Reviewer 1") != "", prop("Reviewer 1"), 0) +
  if(prop("Reviewer 2") != "", prop("Reviewer 2"), 0) +
  if(prop("Reviewer 3") != "", prop("Reviewer 3"), 0)
) / max(
  if(prop("Reviewer 1") != "", 1, 0) +
  if(prop("Reviewer 2") != "", 1, 0) +
  if(prop("Reviewer 3") != "", 1, 0),
  1
)

This formula adds only the filled-in ratings and divides by the count of ratings that exist, preventing division by zero errors. If you're using star emojis in Select fields (like “⭐⭐⭐”), you can convert them to numbers using length(prop("Reviewer 1")), then apply the same formula logic to average those values.

0vote

amandabee Points1550

I tried to use that formula, but it didn't quite work. Here's what actually worked:

(
  length(prop("R1")) +
  length(prop("R2")) +
  length(prop("R3")) 
 )/(
max(1, 
  if(length(prop("R1")) != 0, 1, 0) +
  if(length(prop("R2")) != 0, 1, 0) +
  if(length(prop("R3")) != 0, 1, 0)
)
 )

Add up the length of each reviewer's value (eg. ⭐⭐ has a length of 2), and then build the denominator by adding one to it for each non-zero review (or using 1 if all reviews are 0)

Please log in or register to answer this question.

...

Welcome to Notion Answers, where you can ask questions and receive answers from other members of the community.

Please share to grow the Notion Community!

Connect