let's count how many times until 02/21/2103 patient 13848 had d 12.5 w.
select count(*) from inputevents_cv where inputevents_cv.icustay_id in ( select icustays.icustay_id from icustays where icustays.hadm_id in ( select admissions.hadm_id from admissions where admissions.subject_id = 13848 ) ) and inputevents_cv.itemid in ( select d_items.itemid from d_items where d_items.label = 'd 12.5 w' and d_items.linksto = 'inputevents_cv' ) and strftime('%y-%m-%d',inputevents_cv.charttime) <= '2103-02-21'