PS Query & SQL

 View Only
  • 1.  Flag when there's a Private Loan in a Sum

    Posted 07-22-2026 03:50 PM

    Greetings Friends,

    We're editing a query that display the sum of the offered, accepted, and authorized amounts in a student's financial aid package.

    We want to keep the display to one row per student and add a Y/N flag to indicate whether the offered total includes a private loan.

    For us, a private loan is defined using attributes from ITEM_TYPE_FA:

    • FA_SOURCE = P (Private)
    • FIN_AID_TYPE = L (Loan)

    So far, we've only been able to get two rows for the students who have private loans.  On one row is their private loan amount and everything else is on a separate line.  We're using his expression to do that:

    case when (C.FIN_AID_TYPE) = 'L' and (C.FA_SOURCE) = 'P' then 'Y'
    else 'N'
    end

    Can anyone suggest a different approach?

    Thank you!

    Cheers,
    Jessica



    ------------------------------
    Jessica Holler
    jessica.holler@duke.edu
    ------------------------------
    HEUG ANZ - Brisbane, 9-10 September 2026


  • 2.  RE: Flag when there's a Private Loan in a Sum

    Posted 07-22-2026 04:02 PM

    Jessica,

     

    I assume the amount fields are simply being summed on the Fields tab

     

    For the loan flag field, on the fields tab, set it to MAX.

     

     

    Stephen Forrest

     

    Institutional Research Analyst the Third

    University Decision Support

    Enrollment Management Research Group

    Office of the Provost

    Southern Methodist University

    sforrest@smu.edu

    214-768-4015

     

    "The only reason we put the data in, is to take the data out."

     

     

     

     




    HEUG ANZ - Brisbane, 9-10 September 2026


  • 3.  RE: Flag when there's a Private Loan in a Sum

    Posted 07-22-2026 04:03 PM

    Do you not have to check for an amount > 0  ??

     

     

    Stephen Forrest

     

    Institutional Research Analyst the Third

    University Decision Support

    Enrollment Management Research Group

    Office of the Provost

    Southern Methodist University

    sforrest@smu.edu

    214-768-4015

     

    "The only reason we put the data in, is to take the data out."

     

     

     

     




    HEUG ANZ - Brisbane, 9-10 September 2026


  • 4.  RE: Flag when there's a Private Loan in a Sum

    Posted 07-22-2026 05:36 PM

    Hello Stephen,

     

    To answer your first response:

    Correct, we are summing all aid on the Fields tab using the aggregate feature.

    That's did it!!  Thank you so much!

     

    To answer your second response:

    We are using a Having criterion where the offered amount > 10000.00

     

    Thank you so much!

     

    Cheers,

    Jessica

     

     

    Jessica Holler

    Cell: 312-339-5539

    jessica.holler@duke.edu




    HEUG ANZ - Brisbane, 9-10 September 2026


  • 5.  RE: Flag when there's a Private Loan in a Sum

    Posted 07-22-2026 04:49 PM
    Hey Jessica,

    To go along with what Stephen said, try wrapping your CASE statement in a MAX():

    MAX(case when (C.FIN_AID_TYPE) = 'L' and (C.FA_SOURCE) = 'P' then 'Y'
    else 'N'
    end)

    That way, if any 'Y's exist, they should get smooshed together as an aggregate. If they don't, then the MAX() will be 'N'.

    If you look at your GROUP BY clause after adding the MAX() logic, you should see the CASE statement disappear from it - indicating that it is no longer being partitioned by that field.

    Best,

    Jeffrie

    --
    Jeffrie Brooks | BUSINESS SYSTEM ANALYST
    UNIVERSITY OF MICHIGAN | INFORMATION AND TECHNOLOGY SERVICES
    734-647-8763 | jedobr@umich.edu



    HEUG ANZ - Brisbane, 9-10 September 2026


  • 6.  RE: Flag when there's a Private Loan in a Sum

    Posted 07-22-2026 05:37 PM

    Hello Jeffrie,

     

    Thank you, this explains why using the Max aggregate feature works.

     

    Perfect!

     

    Cheers,

    Jessica

     

     

    Jessica Holler

    Cell: 312-339-5539

    jessica.holler@duke.edu




    HEUG ANZ - Brisbane, 9-10 September 2026