Calculating the average of samples with the same sample description or sample label

Hi,

I'm trying to make a custom calculation to calculate the average of multiple injections in a sequence that are samples from the same batch. I've put the batch number in the sample label and tried using this expression: CurrentSequence.AllPeaksAndGroups.Where(function (x) x.Injection.Sample.Sample_Label).Where(function (x) x.Injection.Sample.Sample_Type= 3).Select(function(x) x.Compound_Concentration).average

but it doesn't seem to work.

Any help would be appreciated thanks.

  • Hello,

    You are missing the rest of the filter to match the sample label. It would be something like Where(function (x) x.Injection.Sample.Sample_Label = CurrentInjection.Sample.Sample_Label) in place of Where(function (x) x.Injection.Sample.Sample_Label). Below is a CC using a similar example that does RSD by compound, by sample type, and by cal level. 

    Marty Adams

    RelStdDev("Peak_Area",CurrentSequence.AllIdentifiedPeaks.Where(function (x) x.Compound_Name = CurrentPeakOrGroup.Compound_Name).Where(function (x) x.Injection.Sample.Sample_Type= CurrentInjection.Sample.Sample_Type).Where(function (x) x.Injection.Sample.Sample_CalibrationLevel= CurrentInjection.Sample.Sample_CalibrationLevel).OrderBy(function(x) x.Injection.CreationTime))

Was this helpful?