This should be doable as an if/then statement. It will depend on whether you want an alternative aggregation (avg, min, etc) or just to combine members of a dimension. Here's an example:
If [Dimension] = 'a' or [Dimension] = 'b' Then SUM([Metric]). END
Let me know if you have any other questions.