I understand. But i cant sort it out in-game, i mean it sometimes works when anotehr character is within the target's range and sometimes not.
Screenshots of situations when its does not work would be most appreciated and helpfull ...
As far as i know, it worked every time for me when i was behind enemy that was threatened by another party member ... AND (and that is most important) i had no disadvantage for attack, since that cancels advantage.

//Edit:
I *suspect* that in situations where you have both disadvantage and advantage, (such as a high ground plus long range, being the most common example), which cancels out and gives a straight attack roll, AND an ally close to your target, it still denies you sneak attack because it reads a disadvantage situation *first* and locks it out right away; this would be incorrect coding of the ability, if that's what's happening.
I believe it would be right coding. O_o
Even tooltip sais you cannot have disadvantage aswell.
https://baldursgate3.wiki.fextralife.com/Sneak+Attack+(Melee)
REQUIREMENTS
You have advantage, or another enemy of the target is within 1.5 m of it and you don't have disadvantage.