detail calculation