Count Specific Data on report (1 Viewer)

vagues0ul

Registered User.
Local time
Today, 01:45
Joined
Sep 13, 2018
Messages
103
i am using switch statement on report to define a criteria. Here is the switch statemtn code i am using
Code:
=Switch([smttl]/[smmttl]*100>90,"A+",[smttl]/[smmttl]*100>=80,"A",[smttl]/[smmttl]*100>=70,"B+",[smttl]/[smmttl]*100>=60,"B",[smttl]/[smmttl]*100>=50,"C",[smttl]/[smmttl]*100>=40,"D",True,"F")

now i want to count how many of the data is A+ or in B's or in C's etc. what should i do to achieve the result like this

A's = 5
B's = 3
C's = 11 etc etc
 

June7

AWF VIP
Local time
Today, 00:45
Joined
Mar 9, 2014
Messages
5,423
Do that calculation in query. That will provide a field to use in defining a GROUPING section in report design. Or use that entire expression to define the group in report design. Then use Count(*) in textbox in group header.
 

NauticalGent

Ignore List Poster Boy
Local time
Today, 04:45
Joined
Apr 27, 2015
Messages
6,280
Take a look at the DCount() Function. You would use it as the record source in an unbound field in the Footer section of your report.
 

NauticalGent

Ignore List Poster Boy
Local time
Today, 04:45
Joined
Apr 27, 2015
Messages
6,280
Sorry June7, I didn’t see you had engaged.
 

isladogs

MVP / VIP
Local time
Today, 08:45
Joined
Jan 14, 2017
Messages
18,186
If those grade boundaries will be reused in the future, I suggest you create a reference table with that information rather than using a lengthy switch statement.

Although using Switch is faster than IIf, referring to a table should be faster still.
If you have many records, it should be a noticeable improvement
 

Users who are viewing this thread

Top Bottom