Skip to main content
Inspiring
Apr 16, 2015 7:27 PM UTC
Answered

Can I Share a value returned from a report function?

I have two report functions:

1. counts all the occurrences of courses that match a specific school year.

2. gives me a total count of courses

I also need to count the occurrences of  courses that do not match a specific school year. How can I subtract the value from the first report from the second report function?

Is there a better way to do this?

This topic is closed to new replies. Start a new post to keep the conversation going.
EddieLotter
EddieLotterCorrect answer
Inspiring
Apr 16, 2015 9:23 PM UTC

As always, try to do as much as you can on the database side.

For example, in Microsoft SQL Server you could do the following:

SELECT

  schoolID, courseID, additionalFields,

  CASE WHEN CourseYear = SchoolYear THEN 1 ELSE 0 END AS CourseYearMatch,

  CASE WHEN CourseYear <> SchoolYear THEN 1 ELSE 0 END AS CourseYearMismatch

FROM tableName

Then, in Report Builder, you can use simple calculated fields to sum these two fields to get the counts you want.

Cheers

Eddie

3 replies

EddieLotter
EddieLotterCorrect answer
Inspiring
Apr 16, 2015 9:23 PM UTC

As always, try to do as much as you can on the database side.

For example, in Microsoft SQL Server you could do the following:

SELECT

  schoolID, courseID, additionalFields,

  CASE WHEN CourseYear = SchoolYear THEN 1 ELSE 0 END AS CourseYearMatch,

  CASE WHEN CourseYear <> SchoolYear THEN 1 ELSE 0 END AS CourseYearMismatch

FROM tableName

Then, in Report Builder, you can use simple calculated fields to sum these two fields to get the counts you want.

Cheers

Eddie

Translate
Cozmo2Author
Inspiring
Apr 17, 2015 3:20 PM UTC

Thanks for your response.

Is there a way I can also count the distinct ID's by Level?

Translate
Cozmo2Author
Inspiring
Apr 20, 2015 2:48 PM UTC

Each student can have multiple courses in the school year and I only want to count them once, how can i do that?

Translate