If I understand you correctly, you want a "Y" if "Maths" is the only subject and "N" if there are any other subjects, correct?
You're going to need to use a variable in a formula to do this. Assuming you're grouping on something like StudentID, the formula is going to look something like this:
StringVar isMathsOnly;
if (PreviousIsNull({student.StudentID}) or {student.StudentID} <> Previous({student.ID})) then
if {secondsubject.Subject} = "Maths" then
isMathsOnly := "Y"
else
isMathsOnly := "N";
else
isMathsOnly :="N";
isMathsOnly
You'll probably have to tweak this to meet your needs and you may not need the semi-colon (;) highlighted in red but it should give you a starting point.
-Dell