Subtraction with conditions

Hello, i am looking for create a new formula.member where i have to perform a simple subtraction but where i want to replace the result by 0 if tje subtraction is negative.

No problem for the subtraction! But where and how can i set the condition to replace negative value by 0?

Hi @clement_dd_64

You can use the CASE statement to check if the result is negative and return 0 in that scenario:

CASE WHEN
([Measures].[First Measure] - [Measures].[Second Measure]) < 0
THEN
0
ELSE
([Measures].[First Measure] - [Measures].[Second Measure])
END

Best regards,
Nauris / eazyBI support

thank you very much!
its works :slight_smile: