If statement issue

Hi Codaites,

I’m having an issue with an If statement. I have two progress bars to track the progress of a project. For projects that are not retainer based, it takes the number of tasks marked done and divides them by the number marked done *100 to get the percentage complete. This works as it should.

Round((thisRow.Milestones.Filter(DoneCheckbox=true).Count())/thisRow.Milestones.Count()*100,1))

If the project type is retainer, then the other progress calculates the number of days that have passed since the project started and divides it by the number of days remaining in the retainer. This also works.

Round(thisRow.DaysPast/thisRow.RetainerDays*100,0),

But if I try to combine them into one progress bar using an If statement, the result only shows the result for the false part of the statement and ignores the true part. Here is the full If statement that incorporates the two formulas above. Any thoughts. on why it doesn’t work?

If(thisRow.[Bill Type]=Retainer,
Round(thisRow.DaysPast/thisRow.RetainerDays*100,0),
Round((thisRow.Milestones.Filter(DoneCheckbox=true).Count())/thisRow.Milestones.Count()*100,1))

Thanks in advance,

—b

If the if statement always evaluates to false then the issue would in “thisRow.[Bill Type]=Retainer”

So the question is, why does this always evaluate to false? Try creating a new column with only this formula to get to the bottom of it

If I had to guess you might want to use the Contains formula instead of equals :slight_smile:

Hi Rickard,

Thanks for the quick reply. Both formulas work on their own but when combined don’t. I tried changing it to BillingType.Contains(Retainer) and it didn’t work, but now suddenly it does. I have no idea why.

Thanks for your help!

—b

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.