Conditional summation on report. (1 Viewer)

sopare

New member
Local time
Yesterday, 23:07
Joined
Feb 28, 2019
Messages
3
I have a report in ms access with sample data below.

ID, Name, Subject, SubCat, GradeValue
01, Aa. Eng. Core. 3
01, Aa. Math. Core. 7
01, Aa. Sci. Core. 3
01, Aa. Soc. Core. 9
01, Aa. ICT. Elective. 3
01, Aa. ABC. Elective. 7
01, Aa. EFG. Elective. 3
01, Aa. IJK. Elective. 9
Aggregate: 26
02, Ab. Eng. Core., 1
02, Ab. Math. Core., 2
02, Ab. Sci. Core., 3
02, Ab. Soc. Core., 1
02, Ab. ICT. Elective. 2
02, Ab. ABC. Elective. 2
02, Ab. EFG. Elective. 3
02, Ab. MNO. Elective. 3
Aggregate: 13
03, Ac. Eng. Core. 6
03, Ac. Math. Core. 2
03, Ac. Sci. Core. 3
03, Ac. Soc. Core. 2
03, Ac. ICT. Elective. 2
03, Ac. ABC. Elective. 4
03, Ac. EFG. Elective. 3
03, Ac. IJK. Elective. 3
Aggregate: 19
I want to do conditional summation on 6 subject for each person.
The conditions for the summation are:
All core subjects with the exception of “Soc”.
3 lowest gradevalues of Elective

Thanks in advance!!!
 

June7

AWF VIP
Local time
Yesterday, 22:07
Joined
Mar 9, 2014
Messages
5,466
The first should be fairly simple. Expression in textbox:

= Sum(IIf(SubCat="Core" And Subject<>"Soc", GradeValue, Null))

Limiting to 3 lowest electives will likely require a separate query using TOP N. Review http://allenbrowne.com/subquery-01.html#TopN. Then joining that query to data table or using DLookup expressions. Or build a custom function to return value to query or textbox.
 

sopare

New member
Local time
Yesterday, 23:07
Joined
Feb 28, 2019
Messages
3
Thanks very much june7. The first part has worked.
 

Users who are viewing this thread

Top Bottom