-- 【月报事率】
select
    incident_ym
     , sum(response_timely_incident_num) / sum(incident_num) response_timely_rate
     , sum(completed_incident_num) / sum(incident_num) completed_rate
     , sum(completed_incident_num - completed_not_close_incident_num) / sum(incident_num) close_rate
     , sum(follow_up_incident_num) / sum(incident_num) follow_up_rate
     , sum(delay_incident_num) / sum(incident_num) delay_rate
     , sum(delay_incident_num) delay_incident_num
     , sum(follow_up_satisfied_incident_num) / sum(follow_up_incident_num) follow_up_satisfied_rate
     , sum(follow_up_evaluate_incident_num) / sum(follow_up_incident_num) follow_up_satisfied_rate1 --

     -- 回访满意量 / -- 回访量
     , sum(tousu_close_incident_num) / sum(tousu_incident_num) tousu_close_rate
     , sum(tousu_incident_num) tousu_incident_num
FROM dws_estate_incident_info_m
where left(incident_ym,4) = '${left(p_ym,4)}'
  AND incident_ym <> DATE_FORMAT(CURDATE(), '%Y%m')
    ${IF(LEN(p_area)>0," AND organ_code IN ('"+JOINARRAY(p_area,"','")+"')", "")}
    ${if(left(fine_role,2)=="项目","and comm_name = '"+GETUSERDEPARTMENTS(3)+"'","")}
group by incident_ym
order by incident_ym



follow_up_satisfied_rate, EXACT(
                incident_ym,
                CONCATENATE(
                                year(TODAY()),  -- 当前年
                                if(
                                        LEN(month(today())-1) = 1, --
                                        CONCATENATE("0",month(today())-1),
                                        month(today())-1
                                  )
                )
             )

EXACT(text1,text2):检测两组文本是否相同。如果完全相同，EXACT函数返回TRUE；否则，返回FALSE。EXACT函数可以区分大小写，但忽略格式的不同。同时也可以利用EXACT函数来检测输入文档的文字。
Text1:需要比较的第一组文本。
Text2:需要比较的第二组文本。
示例:
EXACT("Spreadsheet","Spreadsheet")等于TRUE。
EXACT("Spreadsheet","S preadsheet")等于FALSE。
EXACT("Spreadsheet","spreadsheet")等于FALSE。