Here's a simplified example of the calculated field logic:
IF [Parameter] = "Sheet A" THEN
// Return condition to include all values in the filter
TRUE
ELSEIF [Parameter] = "Sheet B" THEN
// Return condition to exclude "All" value from the filter
[Dimension] <> "All"
END
Replace [Parameter] with the name of your parameter and [Dimension] with the field you are filtering.
Learn How to change the filter values based on the parameters in Tableau?