How do I change all negative values in a column to 0

I have a column named Cur_bal in power bi I just want to know what day function could help me change all negative a to 0 and keep all other values the same.

Upvotes: 0

Views: 1670

Answers (1)

d b
d b

Reputation: 31

You can use either a calculated column or a measure. The formula for a calculated column would be:

Cur_Bal - Positive_Only = 
IF ( 'Table'[Cur_Bal] < 0, 0, 'Table'[Cur_Bal] )

Once you have that, you can use it in an implicit or explicit measure to sum up the total.

For a measure, it would look like this:

Cur_Bal - Positive_Only (measure) = 
CALCULATE ( SUM ( 'Table'[Cur_Bal] ), 'Table'[Cur_Bal] > 0 )

The measure uses a CALCULATE function with a simple filter on Cur_bal column.

Link to image of output sample table...

Upvotes: 1

Related Questions