Forum Discussion

Radhakrushna's avatar
Radhakrushna
Regular Visitor
4 years ago
Solved

Change Values from Negative to Zero in Calculated column

Hello Team,

 

I need you help on priority.

Need to show the Negative values into Zero in calculated column while doing subtract values from one column to another column.

Please find the below screen shot for your reference . 

BBB = Budget - Actual   (in BBB column we can see on row values is in Negative and that should be Zero instead of Negaive value )

 

 

Is it possible...? If possible, please help me on this ASAP on priority.

Thanks for your reply in advance. 

 

Regards,

RK

  • If it's a calculate column try:

     

    BBB =
    VAR Result = TableName[Budget] - TableName[Actual]

    RETURN

    IF ( Result < 0, 0, Result )

3 Replies

  • bcdobbs's avatar
    bcdobbs
    Icon for Community Champion rankCommunity Champion

    If it's a calculate column try:

     

    BBB =
    VAR Result = TableName[Budget] - TableName[Actual]

    RETURN

    IF ( Result < 0, 0, Result )

  • CNENFRNL's avatar
    CNENFRNL
    Icon for Community Champion rankCommunity Champion

    Enclose your original measure [BBB] with max(0, bla ... bla)

  • If this is a measure and you want the rows to add up to the total, you'll have to iterate over the account type.

     

    For example,

    SUMX ( VALUES ( Table1[Account Type] ), MAX ( 0, [Budget] - [Actual] ) )

    assuming [Budget] and [Actual] are defined measures.