Add ROW_NUMBER() function to SQL query

I have the following query:

select 
DISTINCT(b.org),
b.env,
b.proxy,
b."type",
b.name,
b.policytype,
b.disabled,
b."report refresh date",
b.rank,
first_value(LOWER(a."value")) 
over(partition by
b.org,
b.env,
b.proxy
order by b."report refresh date" desc
rows between unbounded preceding and unbounded following) as "value"


from 
(select *, DENSE_RANK() OVER (ORDER BY "report refresh date" DESC) as rank from infosec.apigee_policy_info_for_proxy) b


left join
(select * from api.apigee_product
where attribute = 'tui-api-domain') a

on a.org = b.org 
and a.env = b.env
and a.proxy = b.proxy

where b.rank <=60

group by b.org,
b.env,
b.proxy,
b."type",
b.name,
b.policytype,
b.disabled,
b."report refresh date",
b.rank,
a."value"

and need to add a function in the end of the above query that calculates the row number. For that I have the following query:

ROW_NUMBER() over (order by "report refresh date" ASC) as rowid

I’m having problems on where to put it, in the first query showned.

Can someone help?

Thank you.