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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

By the same ID I have 2 or more order numbers, but I need just the lowest

Hi everyone,

 

Maybe some one could help me in this question.

 

In dax I have some table:

 

ID                  ORDER            RESULT

121212                1                      1

121212                2                      1

121212                3                      1

 

If I have by the same ID ORDER 1 and ORDER 2 please give me just ONE RESULT, THEN 1.

If I have diferents ID let it so.

 

Thank you.

 

 

 

1 ACCEPTED SOLUTION

@Anonymous 

 

You may use DAX below to add a calculated column.

Column =
MINX (
    FILTER ( 'Table', 'Table'[ID] = EARLIER ( 'Table'[ID] ) ),
    'Table'[ORDER]
)

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
JarroVGIT
Resident Rockstar
Resident Rockstar

Alright, just as a bit of feedback: the WHOLE CAPS THING kinda makes it seem like you are screaming 😉 It is not necessary, there are a lot of people willing to help you out if you formulate your question to the point and complete.

 

To your question: what are you expecting as a result? Do you want a filter? Are you expecting one value (the value of column RESULT)? 

If you want to get a filter context where you only get the row with the lowest ORDER, then try this:

VAR curID = Table[ID]
VAR minOrder = CALCULATE(MIN(Table[ORDER]), FILTER(ALL(Table), Table[ID] = curID))
RETURN
FILTER(Table, Table[ID] = curID && Table[ORDER] = minOrder)

These are parts of valid DAX but without knowing what your expected result is, we can't provide you with a solid answer. 

Your logic is clear, you expected output isn't.

 

Kind regards

Djerro123

-------------------------------

If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.

Keep those thumbs up coming! 🙂

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Thank you for your answer djerro123,

 

what I expect to do is to get just one order number.

 

ID                           ORDER NR                     (ORDER NR2)

 

121212                           1                                      1

121212                           2                                      1

121212                           3                                      1

121200                           1                                      1

121201                           2                                      2

121212                           4                                      1

131313                           3                                      3

131313                           4                                      3

141414                           2                                      2

141414                           3                                      2

 

What I supose to get is just the result form (ORDER NR2).

 

Thank you.

@Anonymous 

 

You may use DAX below to add a calculated column.

Column =
MINX (
    FILTER ( 'Table', 'Table'[ID] = EARLIER ( 'Table'[ID] ) ),
    'Table'[ORDER]
)

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-chuncz-msft  Hi and thank you for your answer, it works great if we have at all in the same table as a column. But how could it works when we have it in separate table1 whithout a merge at ETL?

Anonymous
Not applicable

Thank you for your answer djerro123,

 

what I expect to do is to get just one order number.

 

ID                           ORDER NR                     (ORDER NR2)

 

121212                           1                                      1

121212                           2                                      1

121212                           3                                      1

121200                           1                                      1

121201                           2                                      2

121212                           4                                      1

131313                           3                                      3

131313                           4                                      3

141414                           2                                      2

141414                           3                                      2

 

What I supose to get is just the result form (ORDER NR2).

 

Thank you.

Anonymous
Not applicable

@JarroVGIT 

 

What I expect to do is to get just one order number, the lowest filtered.

 

ID                           ORDER NR                     (ORDER NR by the Lowest Value)

 

121212                           1                                      1

121212                           2                                      1

121212                           3                                      1

121200                           1                                      1

121201                           2                                      2

121212                           4                                      1

131313                           3                                      3

131313                           4                                      3

141414                           2                                      2

141414                           3                                      2

 

Table result:

 

121212                                                                    1

121200                                                                    1

121201                                                                    2

131313                                                                    3

141414                                                                    2                  

 

Thank you.

Anonymous
Not applicable

Thank you for your answer djerro123,

 

what I expect to do is to get just one order number.

 

ID                           ORDER NR                     (ORDER NR2)

 

121212                           1                                      1

121212                           2                                      1

121212                           3                                      1

121200                           1                                      1

121201                           2                                      2

121212                           4                                      1

131313                           3                                      3

131313                           4                                      3

141414                           2                                      2

141414                           3                                      2

 

What I supose to get is just the result form (ORDER NR2).

 

Thank you.

Anonymous
Not applicable

Thank you for your answer djerro123,

 

what I expect to do is to get just one order number.

 

ID                           ORDER NR                     (ORDER NR2)

 

121212                           1                                      1

121212                           2                                      1

121212                           3                                      1

121200                           1                                      1

121201                           2                                      2

121212                           4                                      1

131313                           3                                      3

131313                           4                                      3

141414                           2                                      2

141414                           3                                      2

 

What I supose to get is just the result form (ORDER NR2).

 

Thank you.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Users online (3,623)