Height is the variable that most affects whether the shelf looks intentional or awkward. Too low and it feels like it's hovering over whoever's sitting there. Too high and it disconnects from the furniture below and reads as a shelf that belongs on a different wall.
The practical range is 10" to 18" above the top of the sofa back. Within that range:
10" to 12" creates a tight, layered relationship between the seating and the shelf. Works well for lower-profile sofas and rooms with standard 8' ceilings.
14" to 18" gives more breathing room and suits taller sofas, higher ceilings, or a display style that includes taller objects like plants, vases, or stacked books.
Above 18" starts to disconnect visually. The relationship between shelf and furniture weakens and the whole thing reads as placed by measuring from the ceiling rather than from what's below it.
Read more sofa floating shelf style tips here: How to Style Floating Shelves in Your Living Room (Above the Sofa, Around the TV, and More)