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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
tlipkin
Frequent Visitor

Determine min number by category while excluding records from consideration

I need to add a column to use for further analysis that gives me the minimum ItemId for each Category. In addition, though, I need to not consider ItemId records that have a Status of “Withdrawn” when determining which is the minimum ItemId.  I have been successful the following two ways in determining the minimum ItemId by Category but I don’t know how to add the filter to exclude the “Withdrawn” Status when performing this calculation. 

 

CALCULATE(MIN(table1[ItemId]),FILTER(table1,table1[Category]=EARLIER(table1[Category])))

 

CALCULATE (MIN (table1[ItemId]),ALLEXCEPT (table1, table1[Category])

 

Here is a sample dataset and what my expected result is.

 

Category

ItemId

Status

Min Item # Not Withdrawn

1005189150

2106967

Withdrawn

2106968

1005189150

2106968

Completed

2106968

1005189150

2108134

Withdrawn

2106968

1005189150

2108139

Withdrawn

2106968

1005189150

2108165

Withdrawn

2106968

1005189150

2108204

Withdrawn

2106968

1005189150

2108206

Completed

2106968

1005268528

2118244

Withdrawn

2119115

1005268528

2119115

Active

2119115

1005268528

2126390

Withdrawn

2119115

1005268528

2129706

Active

2119115

1005268528

2131912

Active

2119115

1005268528

2131922

Active

2119115

1 ACCEPTED SOLUTION
TheoC
Super User
Super User

Hi @tlipkin 

 

You were quite close with your approach.  A slight adjustment to the below using a Calculated Column will get you what you're after:

 

_col = 

VAR _1 =
    CALCULATE (
        MIN ( _Table[ItemId] ) ,
        _Table[Status] <> "Withdrawn" ,
        ALLEXCEPT ( _Table , _Table[Category] ) )

RETURN

_1

 

Output is as per below screenshot:

 

TheoC_0-1666739893028.png

 

Hope this helps 🙂


Theo

 

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

2 REPLIES 2
TheoC
Super User
Super User

Hi @tlipkin 

 

You were quite close with your approach.  A slight adjustment to the below using a Calculated Column will get you what you're after:

 

_col = 

VAR _1 =
    CALCULATE (
        MIN ( _Table[ItemId] ) ,
        _Table[Status] <> "Withdrawn" ,
        ALLEXCEPT ( _Table , _Table[Category] ) )

RETURN

_1

 

Output is as per below screenshot:

 

TheoC_0-1666739893028.png

 

Hope this helps 🙂


Theo

 

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

tlipkin
Frequent Visitor

Thank you @TheoC.  That worked great!!!

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.