select
concat(right(ym,2) + 0 , '月') ym
, sum(plan_num) plan_num
, sum(plan_complete_num) plan_complete_num
, sum(plan_incomplete_num) plan_incomplete_num
, sum(plan_complete_num) / sum(plan_num) plan_complete_rate
, sum(plan_adjust_num) plan_adjust_num
, sum(plan_adjust_num) / sum(plan_num) plan_adjust_rate
from dws_operation_plan_summary_m a
left join (select distinct organ_code, organ_name, comm_id, comm_name
, oa_organ_code, oa_organ_name, oa_comm_id, oa_comm_name from dim_organ_mapping where comm_id is not null) b
on a.subcompanyid = b.oa_comm_id
where 1=1
${if(len(organ)=0,"","and organ_code = '"+organ+"'")}
and left(ym,4) = '2024'
group by ym
order by ym asc