df=spark.createDataFrame([(1,'X', '01/01/20',5),
(1,'Y', '01/01/20',10),
(1,'Z', '01/01/20',1000),
(2,'X', '01/02/20',20),
(2,'Y', '01/02/20',30),
(2,'Z', '01/02/20',2500)],['ID','VAR','DATE','VAL'])
display(df.filter("VAL Between 2000 and 3000").select('ID').join(df,['ID']).filter("VAR in ('X','Y')"))