Row_number () строк в соответствии с необходимым приоритетом и выбрать только строки с самым высоким приоритетом:
with tbl as (
-- source data
select * from
(values
(1 ,'01-06','A',1,'Settle')
,(1 ,'02-06','A',2,'Settle')
,(1 ,'02-06','F',3,'Settle')
,(1 ,'03-06','A',4,'Settle')
,(2 ,'01-06','A',5,'Settle')
,(2 ,'02-06','A',6,'Settle')
,(2 ,'03-06','F',7,'Settle')
) t (IdType, [Date],ActualEst,Value,PriceType)
),
-- the query
prioritized as(
select IdType, [Date],ActualEst,Value,PriceType,
rn = row_number() over(partition by IdType, [Date] order by ActualEst)
from tbl
)
select IdType, [Date], avg(value) v
from prioritized
where rn=1
group by IdType, [Date];