BigQuery/SQL – Split value on specific variants

need to replace duplicates in column market_offers with value that can be SUM for all entries that give main value. but there is a case that there are different rank and country codes so

input

country_code    rank    store_id    category_id offers  market_offers
se              1       14582       1106        410     504860
se              1       1955        1294        2       504860
se              1       9831        1158        151     504860
se              2       666         11158       536     4000
se              2       6587        25863       6586    4000
se              2       6666        158         536     4000
se              5       65853       76722       1521    302
se              5       6587        25863       6586    302

expected result

country_code    rank    store_id    category_id offers  market_offers
se              1       14582       1106        410     168 286
se              1       1955        1294        2       168 286
se              1       9831        1158        151     168 286
se              2       666         11158       536     1333
se              2       6587        25863       6586    1333
se              2       6666        158         536     1333
se              5       65853       76722       1521    151
se              5       6587        25863       6586    151

Answer

Consider below

select * except(market_offers), 
  round(market_offers / count(1) over(partition by market_offers, rank), 2) as market_offers
from `project.dataset.table`               

if applied to sample data in your question – output is

enter image description here