While deriving magnetic field due to a finite wire, small element →dl should be taken perpendicular to direction of current.