Did You Know PS Query expressions can calculate aggregates? Let’s look at calculating a percentage.

By Dede Young posted 06-21-2022 08:06 AM


The PeopleSoft Query tool expression functionality provides diverse capabilities, including decode, substring, case logic, etc.  This functionality is not without headaches and struggle.

For example, have you ever tried to calculate the fill percentage of class sections?  This simple expression can provide that information.

However, if the enrollment total is equal to zero, you may have encountered this message:

An easy solution to this problem: add a value so far out in to the right of the decimal that it creates a value above zero, yet will not affect your calculated result.

Now your query will run and provide you with the percentage, in decimals:

If you prefer whole numbers with ‘%’ at the end, try this:

The results will look something like this, and it will keep going until it reaches the end of the decimal if the length is long enough!

You may want to consider rounding, like this:




**TRAG member Nilgun Oneren provides another option using decode:


1 comment



06-21-2022 09:21 AM

This is VERY useful!