DAX code
Top N Sales (Incl. Others) =
VAR TopCount = 5
VAR CurrentRank = [Rank by Sales]
RETURN
IF(
HASONEVALUE('Product'[ProductName]),
IF(CurrentRank <= TopCount, [Total Sales], BLANK()),
[Total Sales] -- keeps the grand total row intact so a chart's "Others" slice can be its remainder
)