How to filter with a value in the existing query

Hi All,

Sorry for the blast,

This query returns the close date for all the dates but i need only the last date. Is there a way i can use the last_date as a where condition to filter only those matchin records?

MATCH (c:Customer)-[:OWNS]->(a:Account) OPTIONAL MATCH (a)-[p:PURCHASED]->(f:Fund)-[:HAS_DAILY_CLOSE]->(fc:DayClose) WITH c, a, f, p, COLLECT(fc) AS fundCloses UNWIND fundCloses AS fc RETURN c.owner_name AS owner_name, a.account_type AS account_type, fc.ticker AS ticker, MAX(fc.date) AS last_date, fc.date as dt, //p.number_of_shares AS number_of_shares, //fc.close AS close, CEIL(p.number_of_shares * fc.close) AS value ORDER BY last_date DESCENDING;

Yes. Change your “return” to a “with”, add a “where” after the “with” to filter, end with a “return *” (asterisk so you don’t have to repeat all your return values), and leave out the “order by” if no longer needed