Also, if you put a triple backtick (```) before and after your code (or highlight it and select the </> button on the editor), it will be easier to read, like this:
server <- function(input, output, session) {
output$branch <- renderPlotly({
branch<-dbGetQuery(conn,"
SELECT DISTINCT Branch AS Branch FROM inventory GROUP BY Branch " )
bran<-dbGetQuery(conn,"SELECT SUM(ABS(sales)) AS SALES FROM inventory GROUP BY Branch ")
data<- data.frame(branch$Branch,bran$SALES)
p<-plot_ly(data,x = ~branch$Branch, y = ~bran$SALES, type='scatter', color =I("green"),mode='markers',marker = list(size =60, opacity = 0.5))%>%
#add_trace(y = ~Bran$SALES, name = 'BRANCH') %>%
layout(title = "BRANCHWISE SALES" ,xaxis = list(title='BRANCH <br> '),yaxis = list(title = 'SALES'), barmode='bar')
})