It’s not currently possible in formulas for fields, but it is possible in formulas used in automation actions. See here for info on ‘entity queries’