Help with writing queries or create a dashboard card find out men time to remediation

I want to create a query or a dashboard card find out the mean time to remediation for critical vulnerabilities. I want to start date to be first time it discovered not the date vulnerability published.

Query to find how long it took to remediate from the date of discovery in the environment.

This thread might provide some inspiration. I believe there are other examples, if you search for something such as “remediation time”.