If anyone could produce aggregated data on this (for England) it would be NHS Digital They receive and collate data from the NHS Mental Health Minimum Dataset, in theory from all hospitals (whether NHS or private) which treat NHS patients
In principle, for every NHS funded mental health patient in England the dataset contains (amongst a lot of other things) a record of their Mental Health Act Status (eg informal, section 3, s37 hospital order) and changes to that status over time. It should also include data that shows whether they have moved from an open ward to a secure ward.
What the data quality is like, I don’t know (publications from the dataset tend to come with warnings about missing data). Nor do I know how practical it would be for NHS Digital to extract the numbers you want (it isn’t something they routinely publish), nor whether they would be prepared to try (either for free, or at a charge).
That said, I wonder what any such data would actually signify. In the absence of details about individual cases, progression from informal admission on an open ward to detention on a secure ward could just as easily be consistent with good care as rotten care.