Forum Discussion

KariLang's avatar
KariLang
Qrew Member
5 months ago

Formula to include a field if conditionally.

I currently have 3 fields that i am adding to gether in a formula 

[Other Savings Field 2.1]+[Other Savings Field 2.2]+[Other Savings Field 2.3]  now if i wanted to add Other savings 1.1 to it conditionally.   How would i go about writing a formula like that.  My thought was to maybe have a checkbox to add to total but woudl that work?  How would the formula work?  Or is there a different way to have that field added to total?  



------------------------------
Kari Lang
------------------------------

3 Replies

  • Do you have a clean way to add 1.1 conditionally through another field/IF logic? The syntax is pretty easy - something like: 

    [Other Savings Field 2.1]+[Other Savings Field 2.2]+[Other Savings Field 2.3]  + 

    If( condition goes here, [Other Savings Field 1.1], 0)

    So lets say you had a checkbox to 'Include 1.1' - then you would have it like: 

    [Other Savings Field 2.1]+[Other Savings Field 2.2]+[Other Savings Field 2.3]  + 

    If( [Include 1.1], [Other Savings Field 1.1], 0)

    In the above it will return 0 if you don't want to include it. 



    ------------------------------
    Chayce Duncan
    ------------------------------
    • KariLang's avatar
      KariLang
      Qrew Member

      I am getting an error on the calculation stating expecting text but found a number. Any suggestions on how to fix this?



      ------------------------------
      Kari Lang
      ------------------------------
      • ChayceDuncan's avatar
        ChayceDuncan
        Qrew Captain

        Can you confirm if the field [Other Savings Field 1] is a numeric field? It looks like in the scope of the if() statement that it's interpreting that field as text, so if that field type is text then wrap it in a ToNumber field like: 

        [FTE Reduction Savings2]+[Rework. Final Amount]+[Medical Cost Savings1] + [Automation Savings.1] + if( [Include in Total calculation1], ToNumber([Other Savings Field 1]), 0)



        ------------------------------
        Chayce Duncan
        ------------------------------