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

View all the Fabric Data Days sessions on demand. View schedule

Reply
maibacherstr
Helper III
Helper III

For a Given ID#, 1-N Sequence#, and Status Column, Return the Min of Seq. for Rows Where Status =""

Hello, I hope the below table will help describe a new measure needed. Given repeating ID numbers and a 1-N Sequence assigned to each, we also have a Status column with several blanks. The new measure should return a Status shown in the new column at the far right. Basically, the formula must identify the minimum sequence # for a given ID where Status is blank.

 

@Greg_Deckler thanks for answering a similar question elsewhere, unfortunately it couldn't get me all the way on this one...

 

Thank you all in advance.

 

IDSequenceStatus// My Description //Result In New Column
11Approved<--Rows with a Status are all setApproved
12Approved Approved
13Rejected Rejected
21Approved Approved
22Approved Approved
23 <--Minimum Sequence of a given ID, and Status = (blank)Should read "In Progress"
24 <--Not the min. Seq. for the given ID, and Status = (blank)Should read "To Do"
31Approved Approved
32Rejected Rejected
41Approved Approved
2 ACCEPTED SOLUTIONS

Is there anything different about your table compared with the table you originally posted? Perhaps more columns? If so, this slight change might work better:

Column = 
VAR MinSequence =
CALCULATE(
Min('Table'[Sequence])
, ALLEXCEPT('Table','Table'[ID])
, 'Table'[Status] = BLANK()
)
RETURN
SWITCH(
TRUE
, 'Table'[Status] = BLANK()
&& 'Table'[Sequence] = MinSequence
, "In Progress"
, 'Table'[Status] = BLANK()
&& NOT 'Table'[Sequence] = MinSequence
, "To Do"
, 'Table'[Status]
)

For info, the previous formula was only ignoring Sequence when finding the minimum Sequence value across matching IDs. The second formula ignores everything but the ID (this part: ALLEXCEPT('Table','Table'[ID]))

View solution in original post

Hi @maibacherstr ,

 

I turned the measure into a calculated column. Result:

tomfox_0-1645303533533.png

 

Here my code:

TomsStatusColumn = 
VAR _minNotBlank =
CALCULATE ( 
    MINX ( Table, Table[Sequence] ),
    Table[Status] = BLANK(),
    ALLEXCEPT ( Table, Table[ID] )
) 
RETURN
SWITCH (
    TRUE(),
    Table[Status] <> BLANK(), Table[Status],
    Table[Sequence] = _minNotBlank, "In Progress",
    "To Do"
)

 
Hope with this you get closer to a solution that works for you! 🙂

 

/Tom

https://www.tackytech.blog/

https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

8 REPLIES 8
tackytechtom
Super User
Super User

Hi @maibacherstr ,

 

Here might a way to do it:

tomfox_0-1645218425749.png

 

Here is the code for the measure:

TomsStatusMeasure = 
VAR _minNotBlank =
CALCULATE ( 
    MINX ( Table, Table[Sequence] ),
    Table[Status] = BLANK(),
    ALLEXCEPT ( Table, Table[ID] )
) 
RETURN
SWITCH (
    TRUE(),
    MAXX ( Table, Table[Status] ) <> BLANK(), MAXX ( Table, Table[Status] ),
    MAXX ( Table, Table[Sequence] ) = _minNotBlank, "In Progress",
    "To Do"
) 

 

Let me know if it works for you! 🙂

 

/Tom

https://www.tackytech.blog

https://www.instagram.com/tackytechtom



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Hi Tom, as opposed to a helper column, I'm shakier on measures (realizing that's what I asked for..) but trying to make it work. In its final format, the measure actually needs to produce whole numbers, which I've adapted in a numerical Status column, as well as in your measure, in both cases where Approved = 1; Rejected = 2; In Progress = 3; To Do = 4. (To confirm, the measure is formatted as a whole number).

 

Looking good so far, the measure is dropped into the conditional format of a table, intended to produce icons for each status. Unfortunately, this has only produced a handful of "To Do" icons, but nothing else shows.

 

I'm going to keep working at this, but if you have any suggestions I greatly appreciate your time and energy sharing. Thanks, - Dan

Hi @maibacherstr ,

 

I turned the measure into a calculated column. Result:

tomfox_0-1645303533533.png

 

Here my code:

TomsStatusColumn = 
VAR _minNotBlank =
CALCULATE ( 
    MINX ( Table, Table[Sequence] ),
    Table[Status] = BLANK(),
    ALLEXCEPT ( Table, Table[ID] )
) 
RETURN
SWITCH (
    TRUE(),
    Table[Status] <> BLANK(), Table[Status],
    Table[Sequence] = _minNotBlank, "In Progress",
    "To Do"
)

 
Hope with this you get closer to a solution that works for you! 🙂

 

/Tom

https://www.tackytech.blog/

https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Hi Tom, in my first go at this, I realized I added the row ID instead of the ID column relevant to my model. I opted for your Column formula which worked right away after I cut over to the correct field. 

 

Many thanks for sharing your expertise! 

Russell-PBI
Resolver II
Resolver II

Hi @maibacherstr, maybe a calculated column would serve?:

Column = 
VAR MinSequence =
CALCULATE(
Min('Table'[Sequence])
, ALL('Table'[Sequence])
, 'Table'[Status] = BLANK()
)

RETURN
SWITCH(
TRUE
, 'Table'[Status] = BLANK()
&& 'Table'[Sequence] = MinSequence
, "In Progress"
, 'Table'[Status] = BLANK()
&& NOT 'Table'[Sequence] = MinSequence
, "To Do"
, 'Table'[Status]
)

EDIT: Tidied up with a VAR.

Hi @Russell-PBI the formula looks great and I adapted the table and column names carefully, and doublechecked my comparison back to the dataset; but for each Blank() Status, the formula is only returning "In Progress." The breakout of the "To Do" Status is the critical purpose... that said, I'm continuing to try to work this out. If you can think of any suggestions, please send. I appreciate your time and energy very much.

Is there anything different about your table compared with the table you originally posted? Perhaps more columns? If so, this slight change might work better:

Column = 
VAR MinSequence =
CALCULATE(
Min('Table'[Sequence])
, ALLEXCEPT('Table','Table'[ID])
, 'Table'[Status] = BLANK()
)
RETURN
SWITCH(
TRUE
, 'Table'[Status] = BLANK()
&& 'Table'[Sequence] = MinSequence
, "In Progress"
, 'Table'[Status] = BLANK()
&& NOT 'Table'[Sequence] = MinSequence
, "To Do"
, 'Table'[Status]
)

For info, the previous formula was only ignoring Sequence when finding the minimum Sequence value across matching IDs. The second formula ignores everything but the ID (this part: ALLEXCEPT('Table','Table'[ID]))

Hi @Russell-PBI I'm sure this formula works! Hopefully the subject line of this thread will help others find and learn from it. Many thanks for putting in time to help!  - Dan

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.