Sales of the slowest 3 months with TOPN ASC
Add up your three weakest months for any category, region or year by sorting TOPN in ascending order.
You will learn to
- Take the bottom N rows with TOPN and ASC
- Rank a list of months with VALUES
- Keep the months inside the current filter
How it works
TOPN has an optional fourth argument for the order. It is `DESC` by default, which keeps the largest values. Write `ASC` and TOPN keeps the **smallest** ones instead, so the same function gives you a bottom N.
The table can be any list, not just a table like Product. `VALUES('Date'[Month Year])` is the list of visible months, and `VALUES('Date'[Date])` is the list of visible days, so either can be ranked by a measure.
As with any TOPN, the result is a table. Iterate it with SUMX and the measure to add up those months’ sales. Using `VALUES` rather than `ALL` keeps the search inside the current filter, so a year filter looks only at that year’s months.
Practice it hands-on with a real data model and a live report that updates as you type.
Bottom 5 Customer Sales = SUMX(TOPN(5, Customer, [Total Sales], ASC), [Total Sales])