calculate dialog