Hard to answer this without seeing your calculations, etc. Any chance you can share a workbook or mockup a workbook with non-confidential data?
If I understand this question, you want to sort segments within Stacked Bars by Value. There is a great tutorial on this topic here:
I think the issue is that he's using some table calculations and the sorting then causes those table calculations to go astray. We probably need to see a sample workbook.
If you are happy just to eyeball it, simply drag the colours in your legend up or down to the order you want them in.