Sub topic 7
Basic, advanced, Top N, and relative date filters
This chapter covers the four filter types in the Filter pane. It assumes you can open a report in Power BI Desktop, know what the Filter pane is, and understand the difference between visual-level, page-level, and report-level scope from the previous chapter. It also assumes you know the basic difference between a column and a measure.
The four filter types at a glance
Every filter in the Filter pane has a type. The type controls how you describe the rows you want to keep. The scope (visual, page, or report) controls where the filter applies. These two choices are independent. You can use any type at any scope, with one exception: Top N filters are available on visual-level filters only in some versions and field configurations, so check the dropdown for the field you are using.
The filter type options you see depend on the data type of the field.
| Filter type | Typical field type | What you specify | Typical use |
|---|---|---|---|
| Basic filtering | Text, number, date | A checklist of values to keep | Keep three regions out of ten |
| Advanced filtering | Text, number, date | One or two conditions joined by And or Or | Sales between 1,000 and 5,000 |
| Top N | Text or category fields | A count, a direction, and a ranking value | The five best-selling products |
| Relative date | Date fields | A time unit, a length, and an anchor to today | The last 30 days |
| Relative time | Date and time fields | Minutes or hours relative to now | The last 4 hours |
A filter removes rows from the data a visual uses. It does not delete anything from the model. When you clear the filter, the rows come back.
Basic filtering
Basic filtering is the default for most fields. You drag a field into the Filter pane, expand its card, and tick the values you want. The card also has a search box, which helps when a column has hundreds of values.
Key behaviors:
- Ticking values keeps only those values. Ticking nothing means no filter is applied, which is the same as ticking everything.
- Select all is a checkbox at the top of the list. It keeps all current values, and Power BI also keeps values that appear in the data in the future.
- Each value shows a count of rows or a bar next to it in some configurations, which helps you see how much data each choice represents.
- Numeric fields in basic mode behave like categories. Power BI lists each distinct number. For a continuous number such as price, a list of every value is rarely what you want. Use advanced filtering instead.
A common mistake is to tick values by hand for a field that changes over time. If you tick the 12 products that exist today, a new product added next month is excluded. When the rule you mean is "everything except these two," ticking the two and choosing the exclude option is more durable, or use an advanced rule.
Advanced filtering
Advanced filtering lets you describe a condition instead of listing values. You pick an operator, type a value, and optionally add a second condition joined by And or Or.
Operators depend on the data type:
- Text: contains, does not contain, starts with, does not start with, is, is not, is blank, is not blank.
- Number: is less than, is less than or equal to, is greater than, is greater than or equal to, is, is not, is blank, is not blank.
- Date: is on or after, is after, is on or before, is before, is, is not, is blank, is not blank.
You choose Apply filter to commit the condition. Until you do, the visual does not change. This is a frequent source of "my filter does nothing" reports.
And versus Or
The connector decides how the two conditions combine.
- And keeps rows that satisfy both conditions.
is greater than 1000Andis less than 5000keeps values between the bounds. - Or keeps rows that satisfy either condition.
contains BikeOrcontains Helmetkeeps both product groups.
Be careful with Or on a range. is less than 1000 Or is greater than 5000 keeps the extremes and drops the middle, which is the opposite of what many people intend.
Filtering on a measure
You can place a measure in the Filter pane. The condition is then evaluated against the measure's value for each visible group in the visual, not against raw rows. For example, filtering the measure Total Sales to "is greater than 10000" in a visual that shows one row per product keeps only products whose total sales exceed 10,000.
This is why the same filter can behave differently at different scopes. At visual level the measure is evaluated at the grain of that visual. At page or report level, a measure filter is evaluated for each visual's own grain, so one visual might keep a category while another drops it. Power BI limits where measure filters can appear, and some measure filters are not allowed at report level. If the option is missing, filter on a column or move the filter to the visual.
Top N filtering
Top N keeps the highest or lowest N items of a field, ranked by a value you choose. It has three parts:
- Show items: Top or Bottom, and the number N.
- By value: the field or measure used for ranking. Drag it into the box.
- Apply filter: commit the setting.
Example: on a visual that lists products, set Show items to Top 5 and By value to Total Sales. The visual now shows the five products with the highest total sales.
How Top N works with other filters
Top N is evaluated within the other filters that apply. If a slicer limits the report to 2025, the top five products are the top five for 2025. Change the slicer to 2024 and the five products may change. This is usually the behavior you want, and it means the product list is dynamic.
If you want the top five by all-time sales, regardless of the slicer, a Top N filter on its own cannot do that. You would need a measure that ignores the date filter, such as one built with REMOVEFILTERS, and then rank on it. That technique appears in the DAX chapter.
Ties
When several items tie at the cutoff, Power BI includes all tied items. A Top 5 filter can therefore show more than five rows. This is expected behavior and not a bug. If you need exactly five, add a tiebreaker to your ranking measure.
Top N and totals
The total row of a table or matrix is calculated from the rows that survive the filter. If you filter to the top five products, the total shows the sum of those five, not the sum of all products. Readers often misread this. Label the visual clearly, for example "Top 5 products", so nobody mistakes the total for company-wide sales.
Relative date filtering
Relative date filtering describes a period by its distance from today, so it moves as time passes. You do not need to edit it each month.
You choose three things:
- Direction: is in the last, is in this, or is in the next.
- Length: a whole number such as 3 or 12.
- Unit: days, weeks, calendar weeks, months, calendar months, years, or calendar years.
Examples:
is in the last 30 daysshows the 30 days before today.is in this monthshows the current calendar month.is in the last 3 calendar monthsshows the three complete months before the current one.
Calendar units versus rolling units
The difference between "months" and "calendar months" matters.
- Rolling units (days, weeks, months, years) count back from today. "Last 3 months" on 15 November covers roughly 15 August to 15 November.
- Calendar units use whole periods. "Last 3 calendar months" on 15 November covers August, September, and October in full. The current month is excluded.
Add a checkbox to include today when you want the current period counted. Without it, "last 30 days" ends yesterday.
Relative date prerequisites
Relative date filtering needs a proper date or date/time column. It will not appear for a text column that merely looks like a date. If the option is missing, check the column data type in Power Query or the model view. Power BI evaluates "today" against the clock of the report viewer's session in the service, based on UTC and the user's time zone settings in some situations. For reports where the boundary matters, test near midnight and consider storing a dedicated date table with a "today" flag.
Relative time
Relative time works the same way but with minutes and hours. It needs a date/time column, not a date column. It suits operational monitoring reports.
Choosing a type
Use this order of questions to decide:
- Is the field a date? Use relative date if the rule is "recent period." Use advanced if the rule is a fixed start and end.
- Do you want the best or worst items by a value? Use Top N.
- Do you have a rule such as a range or text match? Use advanced.
- Do you have a short list of specific values? Use basic.
Common problems
- Nothing changed after setting a rule. For advanced and Top N filters, select Apply filter.
- Top N shows more rows than N. Ties at the cutoff are all included.
- Relative date option is missing. The field is not stored as a date or date/time type.
- A basic filter drops new values. The filter lists specific values. Switch to an exclusion or an advanced rule.
- A measure filter is unavailable at report level. Filter on a column, or place the filter on the visual.
Exercise
A table shows one row per product with a Total Sales measure. You add a Top N filter: Top 3 products by Total Sales. A slicer then limits the report to 2024. Two products tied for third place in 2024. How many rows does the table show, and why?
Show answer
Four rows. Top N is evaluated after the slicer, so it ranks 2024 sales. The two products tied at third place are both included, so the filter returns the top two plus both tied products.
Exercise
On 15 November, you apply "is in the last 2 calendar months" to a date column. Which dates does the visual include?
Show answer
September and October, in full. Calendar units use whole periods and exclude the current month, November, unless you choose to include the current period.