Live training: next batches coming soon. Join the waitlist:Waitlists open:Developer Training →Developer →Copilot Studio Training →Copilot Studio →

How to Use DAX MAX With Filter in Power BI (12 Practical Examples)

Finding the highest value in Power BI is pretty straightforward when I only need the overall maximum. But when I want to find the highest sale for a specific region, the latest order date for a particular product, or the product associated with the most recent order, I need to apply a filter along with MAX().

In this tutorial, I’ll show you every practical way to use DAX MAX with a filter in Power BI: CALCULATE + MAX, MAXX + FILTER, ignoring slicers with ALL / REMOVEFILTERS, finding the max per group with ALLEXCEPT, and the question I get asked most often — how to return a value from another column that corresponds to the max date.

Every example uses the same small dataset, and I’ve listed the exact result each formula returns, so you can build it yourself and check your work.

Quick answer

To get the maximum value of a column for a specific condition, wrap MAX inside CALCULATE and pass the condition as a filter:

Max Sale Electronics =
CALCULATE (
    MAX ( Sales[SalesAmount] ),
    Sales[Category] = "Electronics"
)

If you need the max of a calculated expression (not a single column), use MAXX over a filtered table instead:

Max Unit Price Electronics =
MAXX (
    FILTER ( Sales, Sales[Category] = "Electronics" ),
    DIVIDE ( Sales[SalesAmount], Sales[Quantity] )
)
Power BI DAX MAX function with filter

The rest of this post explains when to use which, and how to handle the tricky cases.

MAX vs MAXX in DAX: what’s the difference?

Both functions return the largest value, but they work differently:

MAXMAXX
SyntaxMAX(<column>) or MAX(<expr1>, <expr2>)MAXX(<table>, <expression>, [<variant>])
Works onOne column (or compares two scalar values)Any expression, evaluated row by row
TypeAggregatorIterator (the “X” functions)
Accepts a filter directly?No — wrap it in CALCULATEYes — pass FILTER(...) as the table
Can find the max of a measure?NoYes, e.g. MAXX(VALUES(Sales[Region]), [Total Sales])
BlanksSkipped in a columnSkipped
TRUE/FALSE valuesNot supported (use MAXA)Not supported

Rule of thumb: if you want the max of a single column under a condition, use CALCULATE(MAX(...), condition). If you want the max of something you calculate per row, or the max of a measure across groups, use MAXX.

Sample data used in this tutorial

Create a table called Sales in Power BI Desktop (Home > Enter data) with these 10 rows. Set OrderDate to the Date type and Quantity / SalesAmount to Whole Number.

OrderIDOrderDateRegionProductCategoryQuantitySalesAmount
12026-01-05EastLaptopElectronics33600
22026-01-12WestPhoneElectronics54000
32026-02-03EastDeskFurniture2900
42026-02-18NorthLaptopElectronics11200
52026-03-02WestChairFurniture81600
62026-03-15EastPhoneElectronics43200
72026-03-28NorthDeskFurniture31350
82026-04-06WestLaptopElectronics22400
92026-04-20EastChairFurniture61200
102026-04-20NorthPhoneElectronics21600

Notice that orders 9 and 10 share the same date (2026-04-20). That’s deliberate — ties on the max date are a common source of wrong results, and I’ll show you how to handle them in Example 9.

Also create this base measure, which a few examples use:

Total Sales = SUM ( Sales[SalesAmount] )
power bi dax max value with condition

Example 1: Basic MAX (and how filter context already affects it)

Max Sale = MAX ( Sales[SalesAmount] )
dax max value based on condition Power BI

In a table visual, this returns 4000. Now put Region in a table visual next to it:

RegionMax Sale
East3600
North1600
West4000
Total4000
Power BI DAX MAX value based on condition

This is the most important thing to understand: MAX already respects filter context. Every row of the visual, every slicer and every page filter narrows down the rows MAX can see. You only need an explicit filter when you want a condition that isn’t coming from the report — or when you want to remove one.

Example 2: Power BI MAX with one filter using CALCULATE

To get the highest sale for Electronics only:

Max Sale Electronics =
CALCULATE (
    MAX ( Sales[SalesAmount] ),
    Sales[Category] = "Electronics"
)

Result in a card: 4000. By region it returns East = 3600, North = 1600, West = 4000. Change the filter to “Furniture” and the card returns 1600.

Power BI DAX find highest value based on condition

Watch out: CALCULATE overrides the existing filter on that column

Put Category in the rows of a table visual with this measure and you’ll see something surprising:

CategoryMax Sale ElectronicsMax Sale Electronics (KEEPFILTERS)
Electronics40004000
Furniture4000(blank)

The Furniture row shows 4000 because the filter Sales[Category] = "Electronics" replaces the Furniture filter coming from the visual. If you want the conditions to intersect instead, wrap the condition in KEEPFILTERS:

Max Sale Electronics (KEEPFILTERS) =
CALCULATE (
    MAX ( Sales[SalesAmount] ),
    KEEPFILTERS ( Sales[Category] = "Electronics" )
)
Power BI DAX MAX with CALCULATE and filter

Example 3: MAX with multiple filters in Power BI (AND / OR)

AND conditions

Separate filters in CALCULATE with commas — they’re combined with AND:

Max Sale East Electronics =
CALCULATE (
    MAX ( Sales[SalesAmount] ),
    Sales[Category] = "Electronics",
    Sales[Region] = "East"
)
Power BI DAX MAX with FILTER function

Result: 3600 (orders 1 and 6 match; 3600 is the larger).

Power BI DAX MAXX with FILTER example

OR conditions on the same column

Use IN (or ||) when the values come from one column:

Max Sale East or North =
CALCULATE (
    MAX ( Sales[SalesAmount] ),
    Sales[Region] IN { "East", "North" }
)
Power BI DAX MAX vs MAXX with examples

Result: 3600.

OR conditions across different columns

A simple filter argument can only reference one column. For an OR across two columns, use FILTER over just those columns:

Max Sale North or Furniture =
CALCULATE (
    MAX ( Sales[SalesAmount] ),
    FILTER (
        ALL ( Sales[Region], Sales[Category] ),
        Sales[Region] = "North" || Sales[Category] = "Furniture"
    )
)
Power BI DAX difference between MAX and MAXX

Result: 1600 (the matching rows are 3, 4, 5, 7, 9 and 10).

Example 4: MAX with a “greater than” condition in Power BI

Highest sale among orders with a quantity of 3 or more:

Max Sale Qty 3+ =
CALCULATE (
    MAX ( Sales[SalesAmount] ),
    Sales[Quantity] >= 3
)
Power BI DAX maximum value by category

Result: 4000. The same pattern works with >, <, <= and <> (not equal).

Example 5: Power BI MAXX with FILTER (max of a calculated expression)

Suppose you want the highest unit price sold in Electronics. There’s no unit price column, so you have to calculate it per row — that’s a job for MAXX:

Max Unit Price Electronics =
MAXX (
    FILTER ( Sales, Sales[Category] = "Electronics" ),
    DIVIDE ( Sales[SalesAmount], Sales[Quantity] )
)
Power BI DAX maximum value by region

Result: 1200 (the Laptop). FILTER returns only the Electronics rows, and MAXX evaluates the division on each of them and keeps the highest.

Performance tip: if you only need the max of an existing column, prefer CALCULATE(MAX(col), condition) over MAXX(FILTER(Sales, ...), col). Filtering a single column is cheaper for the engine than iterating the whole table, which matters on large fact tables.

Example 6: MAX of a measure in Power BI (highest region or product total)

MAX only accepts a column, so you can’t write MAX([Total Sales]). To find the highest total across a group, iterate the group with MAXX:

Best Region Sales =
MAXX (
    VALUES ( Sales[Region] ),
    [Total Sales]
)

Region totals are East = 8900, West = 8000 and North = 4150, so the result is 8900. Swap Sales[Region] for Sales[Product] and you get 8800 (Phone).

Power BI DAX maximum value by group

To return the name of the best region instead of its value:

Best Region =
VAR RegionTotals =
    ADDCOLUMNS ( VALUES ( Sales[Region] ), "@Sales", [Total Sales] )
RETURN
    MAXX ( TOPN ( 1, RegionTotals, [@Sales], DESC ), Sales[Region] )
Power BI DAX find maximum value for each group

Result: East.

Example 7: Power BI MAX ignoring filters (ALL, REMOVEFILTERS, ALLSELECTED)

Sometimes you need the overall max on every row — for example, to compare each region against the best one.

Max Sale All Regions =
CALCULATE (
    MAX ( Sales[SalesAmount] ),
    REMOVEFILTERS ( Sales[Region] )
)

% of Max Sale =
DIVIDE ( [Max Sale], [Max Sale All Regions] )
RegionMax SaleMax Sale All Regions% of Max Sale
East3600400090%
North1600400040%
West40004000100%
Power BI DAX find highest sales by region

Which remover should you use?

  • REMOVEFILTERS(Sales[Region]) / ALL(Sales[Region]) — ignores every filter on Region, including slicers. (REMOVEFILTERS is simply a more readable alias of ALL when used inside CALCULATE.)
  • ALL(Sales) — ignores every filter on the whole table. The result is 4000 no matter what the user selects.
  • ALLSELECTED(Sales[Region]) — ignores the visual’s row filter but keeps slicer selections. With a Region slicer set to East and North, it returns 3600 (the best of the selected regions), while REMOVEFILTERS(Sales[Region]) still returns 4000 from West. This is usually what users expect.

Example 8: Max per group in a calculated column (ALLEXCEPT)

If you need the max per region stored on every row — for example to flag the top order in each region — use a calculated column:

Region Max Sale =
CALCULATE (
    MAX ( Sales[SalesAmount] ),
    ALLEXCEPT ( Sales, Sales[Region] )
)

Is Top Order in Region = 
IF ( Sales[Total Sales] = Sales[Region Max Sale], "Yes", "No" )
Power BI DAX find highest sales by product

East rows get 3600, West rows 4000, North rows 1600. Orders 1, 2 and 10 are flagged Yes. In a calculated column, CALCULATE turns the current row into a filter (context transition); ALLEXCEPT then removes every column filter except Region.

Note: Calculated columns are computed at refresh and do not react to slicers. If the “top” should change with the user’s selection, use a measure like Example 7 instead.

Example 9: Get a value from another column at the max date in Power BI

This is the most searched scenario: “return the product (or amount, or status) from the row with the latest date.” You can’t get it with MAX alone, because MAX returns a date, not the row.

Method 1: Find the max date, then filter to it

Latest Product = 
VAR LastDate1 = MAX ( Sales[OrderDate] )
RETURN
    CALCULATE (
        SELECTEDVALUE ( Sales[Product] ),
        Sales[OrderDate] = LastDate1
    )
Power BI DAX find highest sales by customer
RegionLatest Product
EastChair
NorthPhone
WestLaptop
Total(blank)

Why is the total blank? At the total level the latest date is 2026-04-20, which has two rows (Chair and Phone). SELECTEDVALUE returns blank when there is more than one value. You have two options:

Show all tied values — replace SELECTEDVALUE(...) with:

CONCATENATEX ( VALUES ( Sales[Product] ), Sales[Product], ", " )

The total now shows Chair, Phone.

Method 2: TOPN with a tie-breaker (always returns one row)

Latest Product (TOPN) =
VAR LastRow =
    TOPN (
        1,
        Sales,
        Sales[OrderDate], DESC,
        Sales[OrderID], DESC
    )
RETURN
    MAXX ( LastRow, Sales[Product] )
Power BI DAX MAX with multiple conditions

The second sort key (OrderID) breaks the tie, so the total returns Phone (order 10). Region rows return the same values as Method 1. Use this method when the business rule is “the most recent record wins.”

Sum of a value on the latest date

Sales on Latest Date =
VAR LastDate = MAX ( Sales[OrderDate] )
RETURN
    CALCULATE ( [Total Sales], Sales[OrderDate] = LastDate )

Result: East = 1200, North = 1600, West = 2400, Total = 2800 (both orders on 2026-04-20).

For more date-focused patterns, see my guide on Power BI DAX Max Date.

Example 10: Max date with a condition

Latest order date for Laptops:

Last Laptop Order =
CALCULATE (
    MAX ( Sales[OrderDate] ),
    Sales[Product] = "Laptop"
)
Power BI DAX MAX with multiple filters

Result: 2026-04-06. MAX works on date columns just like numbers.

Example 11: Fix the total row (sum of max values)

In Example 1, the total row showed 4000 — the max of all rows — not 3600 + 1600 + 4000. If you want the total to add up the per-region maximums:

Sum of Region Max =
SUMX (
    VALUES ( Sales[Region] ),
    [Max Sale]
)

Each region row still shows its own max, and the total now shows 9200.

Example 12: Handle blanks in MAX

MAX(column) skips blanks. If every row in the current context is blank (or there are no rows), it returns BLANK — which hides the row in many visuals. To show 0 instead:

Max Sale or Zero =
COALESCE ( [Max Sale], 0 )

Be careful with the two-argument version, MAX(expr1, expr2): it treats a blank as 0. So MAX(-5, BLANK()) returns 0, not -5 — a subtle bug when comparing negative values.

Common mistakes with DAX MAX and filters

  1. Same value in every row. Your filter uses ALL(Sales) or overrides the column that’s on the visual (see Example 2). Use KEEPFILTERS or ALLSELECTED.
  2. Blank total with SELECTEDVALUE. There’s a tie or multiple values at the total level — use CONCATENATEX or TOPN (Example 9).
  3. MAX([Measure]) gives an error. MAX needs a column. Use MAXX(VALUES(...), [Measure]) (Example 6).
  4. Calculated column doesn’t respond to slicers. That’s by design — use a measure.
  5. MAX on a TRUE/FALSE column fails. Use MAXA, or convert the column to 1/0.
  6. Slow reports on large tables. Replace MAXX(FILTER(FactTable, ...), col) with CALCULATE(MAX(col), column predicates) where possible.

Frequently asked questions

How do I use MAX with a filter in DAX?

Wrap MAX in CALCULATE and add the condition as a filter argument: CALCULATE(MAX(Sales[SalesAmount]), Sales[Category] = “Electronics”). For a calculated expression, use MAXX(FILTER(Table, condition), expression).

What is the difference between MAX and MAXX in Power BI?

MAX returns the largest value in a single column. MAXX iterates a table, evaluates an expression for each row and returns the largest result, so it can handle calculations and measures.

How do I get the max value ignoring slicers?

Use CALCULATE(MAX(column), ALL(Table)) or REMOVEFILTERS(Table). If you want to ignore only the visual’s rows but keep slicers, use ALLSELECTED.

How do I return a value from another column for the max date?

Store the max date in a variable, then filter to it: VAR d = MAX(T[Date]) RETURN CALCULATE(SELECTEDVALUE(T[Value]), T[Date] = d). If several rows share the max date, use TOPN with a tie-breaker column.

Can MAX return text or dates?

Yes. MAX works on date columns (returning the latest date) and on text columns, where it returns the last value in alphabetical order. For TRUE/FALSE columns use MAXA.

Why does my MAX measure return blank?

No rows survive the current filter context, or all values are blank. Check slicers and relationships, and use COALESCE([Measure], 0) if you’d rather show zero.

Conclusion

To use DAX MAX with a filter in Power BI, remember three patterns: CALCULATE(MAX(col), condition) for a single column, MAXX(FILTER(...), expression) for calculated values and measures, and “max date + CALCULATE” (or TOPN) to pull another column’s value from the latest row. Add REMOVEFILTERS, ALLSELECTED or ALLEXCEPT when you need to control which filters apply.

You may also like: