We can combine the Filter and the Sort functions in Google Sheets and get the data in the way we want it to be.
=SORT(FILTER(range, condition1, [condition2, …]),sort_column, is_ascending, [sort_column2, is_ascending2, …])
PRACTICE SHEET
The below sheet is view only mode, please make a copy to practice.