Getting error while applying function

I have created a function but getting error while executing that function, please check what i am dong wrong, i am applying this function in Rmarkdow.

  dat1<-data %>% select(!!filter_var,!!Text_var) %>% filter(!!!Text_var))

I am getting error in below part while when i am checking in debuging mode.

dat2<- dat1 %>% filter((!!filter_var == !!filter_val))

This works for me:

  dat2<- dat1 %>% filter((!!filter_var == filter_val))