with raw_meas as (select m.date
                       , n.site_id
                       , n.cell_name
                       , n.cell

                       , nds(sum(num_dl_prb_utilization_percent), sum(denum_dl_prb_utilization_percent)) as dl_prb_utilization
                       , nds(sum(num_ul_prb_utilization_percent), sum(denum_ul_prb_utilization_percent)) as ul_prb_utilization
                  from r11.meas_4g_daily m
                           join network_cell n on m.network_cell_id = n.id
                  where m.date between '2023-12-01' and '2023-12-07'
                    and n.site_id in
                        ('NTK015', 'NTK073', 'COK059', 'BTI904', 'NTK068', 'TMR063', 'NTK081', 'NTK077', 'NTK047', 'COK036', 'NTK071', 'NTK002', 'NTK075', 'BTI905', 'COK188', 'NTK080', 'NAB205', 'TIM425', 'TUL219', 'NTK056', 'NTK079', 'NAB204', 'NTK082', 'NTK074', 'COK117', 'NTK067', 'TMB035',
                         'TMB171', 'TIM427', 'MSH629', 'TIM461', 'WRS112', 'MWR700', 'NLA383', 'MWR699', 'JAP830', 'SON523', 'BTI906', 'MSH630', 'BIA282', 'NAB211', 'BIA281', 'JAP823', 'AMB025', 'JAP827', 'NAB208', 'JAP826', 'NLA009', 'COK500', 'COK502', 'TIM462', 'NAB207', 'JAP828', 'NAB210',
                         'COK501', 'BTI907', 'MWR707', 'NAB209', 'WAM015', 'NAB029', 'MRK820', 'MRK821', 'KEP066', 'FFK159', 'BIA009', 'TIM183', 'AGA044', 'SON524', 'WRS113', 'WRS114', 'KMN060', 'JAP829', 'TMR064', 'COK503', 'SRU129', 'FFK360', 'AGA045', 'COK171', 'JAP925', 'MSH002', 'SON515',
                         'MWR705', 'MWR706', 'JAP831', 'MRK822', 'TIM463', 'AMB039', 'SRU130', 'JAP832', 'COK180', 'COK191', 'NLA006', 'COK211', 'COK340', 'MSH626', 'SON433', 'COK190')
                  group by date
                         , n.site_id
                         , n.cell_name
                         , n.cell)

select m.date
     , m.site_id
     , m.cell_name
     , m.cell
     , m.dl_prb_utilization
     , m.ul_prb_utilization
from raw_meas m
order by m.site_id, m.date;

