with master as (select m.date

                     , nds(sum(num_rrc_setup_sr), sum(denum_rrc_setup_sr))                                                                         as rrc_setup_sr
                     , sum(num_rrc_setup_sr)                                                                                                       as num_rrc_setup_sr
                     , sum(denum_rrc_setup_sr)                                                                                                     as denum_rrc_setup_sr

                     , nds(sum(num_rrc_setup_sr) * sum(num_e_rab_setup_sr) * sum(s1_signal_connection_est_sr_num),
                           sum(denum_rrc_setup_sr) * sum(denum_e_rab_setup_sr) * sum(s1_signal_connection_est_sr_denum))                           as cssr
                     , sum(num_rrc_setup_sr) * sum(num_e_rab_setup_sr) * sum(s1_signal_connection_est_sr_num)                                      as num_cssr
                     , sum(denum_rrc_setup_sr) * sum(denum_e_rab_setup_sr) * sum(s1_signal_connection_est_sr_denum)                                as denum_cssr

                     , nds(sum(num_e_rab_setup_sr), sum(denum_e_rab_setup_sr))                                                                     as e_rab_setup_sr
                     , sum(num_e_rab_setup_sr)                                                                                                     as num_e_rab_setup_sr
                     , sum(denum_e_rab_setup_sr)                                                                                                   as denum_e_rab_setup_sr

                     , nds(sum(num_e_rab_drop_rate_percent), sum(denum_e_rab_drop_rate_percent))                                                   as e_rab_drop_rate
                     , sum(num_e_rab_drop_rate_percent)                                                                                            as num_e_rab_drop_rate
                     , sum(denum_e_rab_drop_rate_percent)                                                                                          as denum_e_rab_drop_rate

                     , nds(sum(ratio_of_rrc_re_establishment_monitor_num), sum(ratio_of_rrc_re_establishment_monitor_denum))                       as ratio_of_rrc_re_establishment

                     , nds(sum(num_ifho_sr), sum(denum_ifho_sr))                                                                                   as ifho_sr
                     , sum(num_ifho_sr)                                                                                                            as num_ifho_sr
                     , sum(denum_ifho_sr)                                                                                                          as denum_ifho_sr

                     , nds(sum(num_csfb_sr), sum(denum_csfb_sr))                                                                                   as csfb_sr
                     , sum(num_csfb_sr)                                                                                                            as num_csfb_sr
                     , sum(denum_csfb_sr)                                                                                                          as denum_csfb_sr

                     , sum(number_of_rrc_connection_releases_triggered_by_csfb_times)                                                              as number_of_rrc_connection_releases_triggered_by_csfb_times
                     , sum(number_of_redirection_requests_from_lte_to_utran_csfb_times)                                                            as lte_number_of_redirection_requests_from_lte_to_utran_csfb_ranq
                     , sum(number_of_redirection_requests_from_lte_to_gsm_csfb_times)                                                              as lte_number_of_redirection_requests_from_lte_to_gsm_csfb_ranq

                     , nds(sum(s1_signal_connection_est_sr_num), sum(s1_signal_connection_est_sr_denum))                                           as s1_signaling_sr

                     , sum(dl_traffic_volume_mbyte)                                                                                                as dl_traffic_volume_mbyte
                     , sum(ul_traffic_volume_mbyte)                                                                                                as ul_traffic_volume_mbyte
                     , sum(payload_mbyte)                                                                                                          as payload_mbyte

                     , sum(maximum_number_of_rrc_connection_user_unit)                                                                             as maximum_number_of_rrc_connection_user
                     , sum(license_number_of_rrc_connection_user_cell_unit)                                                                        as license_number_of_rrc_connection_user

                     , 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

                     , sum(cell_availability_num)                                                                                                  as cell_availability_num
                     , sum(cell_availability_denum)                                                                                                as cell_availability_denum
                     , nds(sum(cell_availability_num), sum(cell_availability_denum))                                                               as cell_availability

                     , avg(user_dl_throughput_kbps)                                                                                                as user_dl_throughput_kbps
                     , avg(user_ul_throughput_kbps)                                                                                                as user_ul_throughput_kbps
                     , avg(cell_dl_throughput_kbps)                                                                                                as cell_dl_throughput_kbps
                     , avg(cell_ul_throughput_kbps)                                                                                                as cell_ul_throughput_kbps

                     , nds(sum(dl_64qam_modulation_scheme_usage_num), sum(dl_64qam_modulation_scheme_usage_denum))                                 as dl_64qam_modulation_scheme_usage
                     , nds(sum(ul_16qam_modulation_scheme_usage_num), sum(ul_16qam_modulation_scheme_usage_denum))                                 as ul_16qam_modulation_scheme_usage

                     , nds(sum(the_ratio_of_cqi_ge_7_monitor_num), sum(the_ratio_of_cqi_ge_7_monitor_denum))                                       as the_ratio_of_cqi_ge_7_monitor

                     , nds(sum(prb_number_used_on_downlink_channel_unit), sum(prb_number_available_on_downlink_channel_unit))                      as dl_resource_block_utilizing_rate
                     , nds(sum(prb_number_used_on_uplink_channel_unit), sum(prb_number_available_on_uplink_channel_unit))                          as ul_resource_block_utilizing_rate


                     , nds(sum(cce_number_used_on_pdcch_channel_unit), sum(cce_number_available_on_pdcch_channel_unit))                            as pdcch_cce_utilization_rate
                     , nds(sum(prb_number_used_on_pusch_channel_unit), sum(prb_number_available_on_pusch_channel_unit))                            as pusch_prb_utilization_rate
                     , nds((sum(number_of_successful_access_using_group_a_preamble_unit) +
                            sum(number_of_successful_access_using_group_b_preamble_unit) +
                            sum(number_of_successful_access_using_dedicated_preamble_unit)),
                           sum(number_of_available_preamble_unit))                                                                                 as prach_usage

                     , nds(sum(dl_qpsk_modulation_scheme_usage_num), sum(dl_qpsk_modulation_scheme_usage_denum))                                   as dl_qpsk_modulation_scheme_usage
                     , nds(sum(dl_16qam_modulation_scheme_usage_num), sum(dl_16qam_modulation_scheme_usage_denum))                                 as dl_16qam_modulation_scheme_usage
                     , nds(sum(dl_qpsk_modulation_scheme_usage_num), sum(ul_qpsk_modulation_scheme_usage_denum))                                   as ul_qpsk_modulation_scheme_usage
                     , nds(sum(ul_64qam_modulation_scheme_usage_num), sum(ul_64qam_modulation_scheme_usage_denum))                                 as ul_64qam_modulation_scheme_usage

                     , sum(number_of_paging_records_received_by_the_enodeb_unit)                                                                   as paging_number_from_s1

                     , nds(sum(number_of_paging_records_congested_at_the_enodeb_unit),
                           sum(number_of_paging_records_received_by_the_enodeb_unit) + sum(number_of_paging_records_congested_at_the_enodeb_unit)) as paging_congestion_rate
                     , nds(sum(number_of_paging_records_received_by_the_enodeb_unit),
                           sum(number_of_paging_records_send_from_enodeb_unit))                                                                    as paging_success_rate

                     , avg(active_users_rnp)                                                                                                       as active_users_rnp

                     , nds(sum(dl_256qam_modulation_scheme_usage_num), sum(dl_256qam_modulation_scheme_usage_denum))                               as dl_256qam_modulation_scheme_usage

                     , avg(average_cqi)                                                                                                            as average_cqi
                     , avg(cqi_ge_10)                                                                                                              as cqi_ge_10
                     , avg(spectral_efficiency)                                                                                                    as spectral_efficiency

                     , avg(data_integrity)                                                                                                         as data_integrity

                     , nds(sum(inter_freq_lte_ho_num), sum(inter_freq_lte_ho_denum))                                                               as inter_freq_lte_ho
                     , sum(inter_freq_lte_ho_denum)                                                                                                as inter_freq_lte_ho_denum
                     , sum(inter_freq_lte_ho_num)                                                                                                  as inter_freq_lte_ho_num

                     , sum(number_of_paging_records_received_by_the_enodeb_unit)                                                                   as number_of_paging_records_received_by_the_enodeb
                     , sum(number_of_paging_records_discarded_at_the_enodeb_unit)                                                                  as number_of_paging_records_discarded_at_the_enodeb_unit
                     , sum(number_of_paging_records_congested_at_the_enodeb_unit)                                                                  as number_of_paging_records_congested_at_the_enodeb
                     , sum(number_of_paging_records_send_from_enodeb_unit)                                                                         as number_of_paging_records_send_from_enodeb
                     , sum(paging_channel_capacity_unit)                                                                                           as paging_channel_capacity_unit
                     , avg(mean_rrc_connection_setup_time_ms)                                                                                      as mean_rrc_connection_setup_time_ms
                     , avg(mean_time_of_e_rab_setup_ms)                                                                                            as mean_time_of_e_rab_setup_ms
                     , nds(sum(number_of_paging_records_received_by_the_enodeb_unit), sum(number_of_paging_records_send_from_enodeb_unit))         as enb_paging_success_rate
                     , nds(sum(number_of_paging_records_send_from_enodeb_unit), sum(paging_channel_capacity_unit))                                 as paging_channel_usage

                from r11.meas_4g_daily m
                where m.date between date_int(7) and date_int(1)
                group by m.date)
select *
from master
;