Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
AlexMunday
Frequent Visitor

How to find mins in a column related to another column (excel MINIFS)

The idea is to find the min of the value column related to the department column, but the min has to be different from 0.

then we want the second and third min

 

Here are the excel function used:

Small 1 = MINIFS($C:$C;$B:$B;$B2;$C:$C;"<>0")

Small 2 =MINIFS($C:$C;$B:$B;$B2;$C:$C;"<>0";$C:$C;CONCAT("<>";$D2))

Small 3 = =MINIFS($C:$C;$B:$B;$B2;$C:$C;"<>0";$C:$C;CONCAT("<>";$D2);$C:$C;CONCAT("<>";$E2))

 

I have put some data to illustrate:

 

CountryDepartement value Min 1Min 2 Min 3
CHa0,8248310,4912410,7590350,824831
CHb00,5622870,8126210,866854
CHc0,022410,022410,095080,195738
CHd0,0323020,0323020,576650,748025
CHe0,4116740,4116740,7102190,729571
CHf0,3114020,1315880,2330240,311402
ESa0,7590350,4912410,7590350,824831
ESb0,8668540,5622870,8126210,866854
ESc00,022410,095080,195738
ESd0,7607270,0323020,576650,748025
ESe0,7295710,4116740,7102190,729571
ESf0,2330240,1315880,2330240,311402
BRa00,4912410,7590350,824831
BRb0,8126210,5622870,8126210,866854
BRc0,095080,022410,095080,195738
BRd0,576650,0323020,576650,748025
BRe0,7961080,4116740,7102190,729571
BRf0,5207320,1315880,2330240,311402
PRa0,4912410,4912410,7590350,824831
PRb0,5622870,5622870,8126210,866854
PRc0,1957380,022410,095080,195738
PRd0,7480250,0323020,576650,748025
PRe0,7102190,4116740,7102190,729571
PRf0,1315880,1315880,2330240,311402
1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @AlexMunday 

Create a calculated column for the first min:

Min1 =
CALCULATE (
    MIN ( Table1[value ] );
    ALLEXCEPT ( Table1; Table1[Departement ] );
    Table1[value] <> 0
)

Then for min2 using the newly created column:

Min2 =
CALCULATE (
    MIN ( Table1[value ] );
    ALLEXCEPT ( Table1; Table1[Departement ] );
    Table1[value] <> 0;
     Table1[value] <> EARLIER( Table1[Min1])
)

and then for min3

Min3 =
CALCULATE (
    MIN ( Table1[value ] );
    ALLEXCEPT ( Table1; Table1[Departement ] );
    Table1[value] <> 0;
    Table1[value] <> EARLIER( Table1[Min1]);
Table1[value] <> EARLIER( Table1[Min2]) )

 

View solution in original post

2 REPLIES 2
AlB
Community Champion
Community Champion

Hi @AlexMunday 

Create a calculated column for the first min:

Min1 =
CALCULATE (
    MIN ( Table1[value ] );
    ALLEXCEPT ( Table1; Table1[Departement ] );
    Table1[value] <> 0
)

Then for min2 using the newly created column:

Min2 =
CALCULATE (
    MIN ( Table1[value ] );
    ALLEXCEPT ( Table1; Table1[Departement ] );
    Table1[value] <> 0;
     Table1[value] <> EARLIER( Table1[Min1])
)

and then for min3

Min3 =
CALCULATE (
    MIN ( Table1[value ] );
    ALLEXCEPT ( Table1; Table1[Departement ] );
    Table1[value] <> 0;
    Table1[value] <> EARLIER( Table1[Min1]);
Table1[value] <> EARLIER( Table1[Min2]) )

 

Thank you it's working perfectly

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.