Continuing Rick's answer to your previous question(Link), the possible values for CalculationDuration can be set to null/empty. In this way, the duration will be the same as the whole duration(StartTime-EndTime).
As for the bad quality data, the Remark>Usage Notes in Summaries2 method state the following:
The PI server computes time-weighted total by integrating the rate tag values over the requested time range. If some of the data are bad in the time range, the calculated total is divided by the fraction of the time period for which there are good values. Mathematically, this approach is equivalent to assuming that during the period of bad data, the tag takes on the average values for the entire calculation time range. It is important for the user of the data to check the percentGood attribute to determine if the calculation result is suitable for the application's purposes.
I hope this information helps.