= date_sub( $P{endDate}, interval $P{weeksPrior} Week)
and date(cd.value) <= date( $P{endDate})
and ifnull(loc.name,'-') like concat(ifnull($P{locationName},""),"%")
group by if( $P{combineLocs},"--ALL LOCATIONS--", ifnull(loc.name,"--NONE--")), ref.value
order by location, Referral;]]>
0]]>