Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

What's wrong with my IF statement?

I have a report table with data grouped by Contract number.  I tried creating a New Column that should contain the value of CurrEstCost if ProjCost equals zero, else it will contain the ProjCost number.  Simple enough, but whenever there are entries in both CurrEstCost and ProjCost, the result is the sum of the two.

 

I thought that the logic for the new column would be based on the values of the rolled up Contract numbers, but it seems to be looking at the detail records that make up the contract totals.

 

I hope that I'm explaining this clearly.  I appreciate any help.

 

 

7 Replies

  • Hi Anonymous ,

    I'm not sure what causes that kind of behaviour in your calculated column, but I would recommend that for a task like that you use the Add conditional column facility in the Query Editor. 

    Hope that helps,

    Tom

     

  • You are looking at this data in a visual, where the column might have already grouped if not on the line level.

    Can you go to the data view and check this in the table. It seems two or more rows of data is added at the visual level.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      It is the grouped numbers on the visual that I want the IF statement to act on.

       

      In the data view, no line item has entries in both CurrEstCost and ProjCost, so the IF logic won't work there.