What’s the best placement for "select all" option in multiple filer component?

While researching I found two main ways of placing the "Select all" option. One usually appears in the top right corner and another one (used i.e. by Microsoft it seems) is adding a Select all option on top of all filtering options. What's the difference from the user perspective and which one is the best practice?

select all option on the top of filtering options select all on top right corner