Limit Dimension value to Top 5 from Dimension Section of Chart.
There You will get a dropdown for Data Limitation.
Choose Fixed Number from Dropdown and put 5 in Text Box.
Here it will take top 5 according to 1st Measure in Measure Section.
Then In Sorting Option.
You can Sort that Dimension by Using option as Sort by Expression.
There put 2nd measure and apply ascending or descending as required.
It might help.