Filter for treating a fluid in a piping of a heating and/or cooling system, in particular of domestic and/or industrial type, said filter comprising: - a main body internally comprising at least one chamber, - a first mouth and a second mouth respectively comprising a first duct and a second duct allowing the fluid to enter and/or exit said at least one chamber, wherein said first mouth has a first longitudinal axis and the second mouth has a second longitudinal axis, in particular the second mouth being positioned on the main body in such a way that its second longitudinal axis is substantially perpendicular to the first longitudinal axis of the first mouth; - a filtering element for treating the fluid, housed at least partially in said chamber, in particular said filtering element comprising at least one magnetic element adapted to intercept and trap the ferrous impurities that are present in the fluid to be treated, characterized in that said filter comprises a shut-off element housed in a portion of said at least one chamber communicating with said first duct and said second duct, wherein said shut-off element has a substantially cylindrical or truncated conical shape and is provided with an outer wall, a first channel, a second channel, and a septum adapted to divide the first channel and the second channel from each other, said shut-off element being adapted to rotate about a longitudinal axis of its own, which is substantially parallel to or coincides with the first longitudinal axis of the first mouth, so that it can be reversibly switched: - from a first position, in which said shut-off element is positioned in such a way as to allow the flow of fluid to enter the chamber and/or exit the chamber both via the communication of the first duct with said at least one chamber through the first channel and via the communication of the second duct with said at least one chamber through the second channel, - to a second position, in which said shut-off element is positioned in such a way as to prevent the flow of fluid from entering the chamber and/or exiting the chamber, said outer wall obstructing both the communication of the first duct with said at least one chamber through the first channel and the communication of the second duct with said at least one chamber through the second channel. - a main body internally comprising at least one chamber, - a first mouth and a second mouth respectively comprising a first duct and a second duct allowing the fluid to enter and/or exit said at least one chamber, wherein said first mouth has a first longitudinal axis and the second mouth has a second longitudinal axis, in particular the second mouth being positioned on the main body in such a way that its second longitudinal axis is substantially perpendicular to the first longitudinal axis of the first mouth; - a filtering element for treating the fluid, housed at least partially in said chamber, in particular said filtering element comprising at least one magnetic element adapted to intercept and trap the ferrous impurities that are present in the fluid to be treated, - from a first position, in which said shut-off element is positioned in such a way as to allow the flow of fluid to enter the chamber and/or exit the chamber both via the communication of the first duct with said at least one chamber through the first channel and via the communication of the second duct with said at least one chamber through the second channel, - to a second position, in which said shut-off element is positioned in such a way as to prevent the flow of fluid from entering the chamber and/or exiting the chamber, said outer wall obstructing both the communication of the first duct with said at least one chamber through the first channel and the communication of the second duct with said at least one chamber through the second channel.