I have a calculated field that is a product of several fields based on the parameter chosen That is, the parameter is used in a case statement to then choose which field is displayed in the calculated field.

For some reason when I sort on this calculated field, it seems to be sorting improperly, like something in the background is affecting the sort invisibly.

For example, when I sort on Total percent failed descending (first pic) ir works.

When I change the parameter to count of grades rather than percent, it does not work (second pic).

I have a similar issue with another dashboard where none of the sorts seem to work for my parameter based calculated field.

The problem is that you are sorting by an individual field. Changing the parameter selection doesn't change this field. So, the sorting works only for the original field. You can rectify this by creating a new calculated field which will incorporate both total percent and count of grade. I don't know how your data is structured or the names of your fields. So, I'll only provide a general form of the code which you can adjust to suit your requirement.