if the subreport is part of what you want, you can communicate between subreports and the main report using shared variables.
Say your subreport has a count and a flag to whether or not to include the count.
In the subreport:
shared numbervar aCount;
shared booleanvar aBool;
aCount := somevalue; //perhaps using an if statement
aBool := (true or false); //probably as a result of an if statement
in the main report
shared numbervar aCount;
shared booleanvar aBool;
global numbervar totalCount;
if aBool then totalCount := totalCount + aCount;
HTH