Modificando leggermente la query di Ben,
select count(distinct switch_id)
from [email protected]
where dealer_name = 'XXXX'
and creation_date between add_months(trunc(sysdate,'mm'),-1) and last_day(add_months(trunc(sysdate,'mm'),-1))