I was have a problem when I want to join / combine like this
df_pros <- dbGetQuery(con, "SELECT * FROM pros
order by nama_cmo ASC")
df_pros <- df_pros %>%mutate(status = ifelse(
as.Date(scheduled_followup) > as.Date(Sys.Date()), "Terjadwal",
ifelse(as.Date(scheduled_followup) < as.Date(Sys.Date()), " Terlewati",
" Today")))
df_prosfu <- dbGetQuery(con, "SELECT distinct *
FROM pros_fu f
where (f.hasil_fu ='Survey' AND f.tgl_nextfollowup::date <= current_date)
")
totaldariprospek <- observe({
start = input$drange[1]
end = input$drange[2]
date_numb <- as.Date(end) - as.Date(start)
numdays = as.numeric((date_numb)+1)
after i write observe then i want to make a query like this :
df_summ <- df_pros %>% dplyr::select(-prospek_id,hasil_fu) %>%
group_by(nama_cmo) %>% filter(as.Date(create_at) >= start & as.Date(create_at) <= end) %>%
count() %>% rename(`Total Prospek` = n)%>%
rename(`Nama CMO` = nama_cmo)%>%
mutate(`Target Prospek` = 5*numdays)%>%
mutate(`Achievment` = percent(`Total Prospek` /`Target Prospek`))
the i want to combine / join with this query too :
fu_summ <- df_prosfu %>% dplyr::select(-prospek_id) %>% group_by(nama_cmofu) %>% filter(as.Date(tgl_followup) >= start & as.Date(tgl_followup) <= end) %>%
count() %>% rename(`Terlaksana` = n) %>%rename(`CMO FollowUp` = nama_cmofu )%>%
mutate(`Terjadwal & Terlewati` = 10)%>%
mutate(`Achievment FollowUp` = percent(`Terlaksana` /`Terjadwal & Terlewati`))
but error is : Warning: Error in setkeyv: some columns are not in the data.table: prospek_id ,