Obsidian Bases: Formula for star ratings with half stars
I recently started using Obsidian and have been enjoying the Bases feature, which lets you create database-like views using structured notes.
I have a bunch of movie ratings in my notes, and I wanted to display them as stars rather than numbers. The ratings are stored as properties on the notes:
type: [[Movies]]
rating: 4
Now that I have this data, it’s easy to create a view by querying for notes of type: [[Movies]], and adding ratings as one of the properties.

I wanted star ratings to make this easier to read. I came across this article by Tyler Sticka with a formula for star ratings:
'⭐⭐⭐⭐⭐'.slice(0, rating).split('').map(icon('star'))
Here’s how it looks:
![]()
This works for whole numbers, but I use half stars in my ratings. Something rated as 4.5 stars will show up as 4 stars. To add half stars, we need to modify the formula to this:
[
'⭐⭐⭐⭐⭐'.slice(0, rating).split('').map(icon('star')),
if(number(rating) - number(rating).floor() >= 0.5, icon('star-half'), '')
].flat()
This adds a half star when needed:
![]()
However, I wasn’t too happy with the appearance of the builtin star icons, and I prefer the use of the emoji ⭐️ for this. This makes the first part of the formula much simpler:
'⭐⭐⭐⭐⭐'.slice(0, rating)

Now, there’s no half star emoji, so I decided to use the ½ character instead, so the final formula looks like:
[
'⭐⭐⭐⭐⭐'.slice(0, rating),
if(number(rating) - number(rating).floor() >= 0.5, '½', '')
].flat()
This is what the table finally looks like:

I like how easy it is to customize these tables, and how well these formula functions are documented.