5 Replies Latest reply on Feb 14, 2020 6:24 PM by Ken Flerlage

# Max values in rows

Hi everyone,

I need to get a max from these items. for example I need to just shows the household with max units sold 8250.Thank you for any comments.

Fattaneh • ###### 1. Re: Max values in rows

So, you have something like this? If so, we can use an LOD to get the max.

Max Only

```// Get the max for this region, year, and category.
IF SUM([Quantity]) = MAX({FIXED : MAX({FIXED [Region], YEAR([Order Date]), [Category]: SUM([Quantity])})}) THEN
"Keep"
ELSE
"Exclude"
END
```

The above will first get the sum of the quantity for each combination of the three dimensions (the inner LOD), then find the overall max of those sums (the outer LOD). Then it will compare the sum of each row to that max.

Use this as a filter keeping only "Keep" values. Note: If you have filters, you'll want to right-click them and add them to context. This will force them to compute before the LOD calculation. • ###### 2. Re: Max values in rows

Hi Fattaneh,

The above calculation should work. Another approach you could look to play with is:

SUM([Units Sold])=WINDOW_MAX(SUM([Units Sold]))

You'll want to compute using Item Type and then filter on True. Just another way that might fit your needs.

Best,

Bryce

• ###### 3. Re: Max values in rows

Thank you again Bryce.

• ###### 4. Re: Max values in rows

Thank you Ken

• ###### 5. Re: Max values in rows

My pleasure!