Power BI: find the minimum or maximum value

I will explain how to find the minimum/maximum value for a column but also in a list of number in a cell. Let’s start for a column, to find the minimum, I will use this formula:

MINX(FILTER(ALL('table'),'table'[argument]=MIN('table'[argument])),'table'[argument])

And for the maximum:

MAXX(FILTER(ALL('table'),'table'[argument]=MAX('table'[argument])),'table'[argument])

NOTE: change “table” and “argument” by yours

Let’s take an example, I have this data:

power bi

And I want to get the minimum and maximum of “number”:

power bi power bi

Alternatively, I can use measures to sort with another condition, for instance, the “opened” column:

CALCULATE(MIN('table'[argument1]),'table'[argument2]=MIN('table'[argument2]))

power bi

NOTE: for the maximum value, change MIN by MAX

power bi

As an extra, to extract the number of the “number” column, I will use this formula:

RIGHT('table'[argument],LEN('table'[argument])-(SEARCH("value",'table'[argument])))

power bi

NOTE:

  • Replace value by yours. In my example, replace “C” which is the last letter of INC
  • Don’t forget to change the “data type” from “text” to “whole number”
power bi

To find the minimum value for a specific group:

CALCULATE(MIN('table'[argument1]),ALLEXCEPT('table','table'[argument2]))

power bi

NOTE: for the maximum value, change MIN by MAX

power bi power bi

To find the lower number in a list of values, I will have to go to the Power Query Editor then “add column -> custom column”:

power bi

Put this formula:

List.Min(List.Transform(Text.Split([argument]," "),each Number.From(_)))

power bi

NOTE:

  • If numbers are separated by a coma for instance, change " " by ","
  • For the maximum, change “List.Min” by “List.Max”
  • If the list may contain a text, to ignore errors, put “try ... otherwise null”
power bi power bi

You may be interested to read Power BI: extract numbers and/or text.

Interesting Topics