I am a newbie and need to get the grand total of the new_TotalNoofPlanMembers field
and am having some difficulty as this isn't working for me.
new_MembershipNumber AS 'Membership ID',
FullName AS 'Member Name',
new_SalesChannelOnlyforPrivateMembersName AS 'Bll To Corp. Name',
new_TotalNoofPlanMembers AS 'Total # Plan Members'
sum(new_TotalNoofPlanMembers) as 'Grand Total'
Your requirement is a bit vague. So I will assume that the column 'new_TotalNoofPlanMembers' is a previously calculated value. Then in that case I think what you are looking for is COUNT and not SUM (if these are discrete memberships and not money values for instance). Finally, when doing an aggregate such as COUNT or SUM you need to either have a GROUP BY clause or use a windowing function like this:
new_MembershipNumber AS 'Membership ID'
,FullName AS 'Member Name'
,new_SalesChannelOnlyforPrivateMembersName AS 'Bll To Corp. Name'
,new_TotalNoofPlanMembers AS 'Total # Plan Members'
,COUNT(new_TotalNoofPlanMembers) OVER (PARTITION BY new_MembershipNumber) AS 'Grand Total'