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
MrMarshall
Helper II
Helper II

New column based on multiple sorted rows

Trying to create a new column based on multiple sorted rows within the same OrderNumber.

I have the following schema:

DescriptionOrderNumberOrderRow
Art 13000010
Art 23000020
Art 33000030
Art 43000110
Art 53000120
Art 63000130

I want to make a new column with the Description of the rows with the lowest OrderRow value within the same OrderNumber.

Which would be: 

DescriptionOrderNumberOrderdRowNew Column
Art 13000010Art 1
Art 23000020Art 1
Art 33000030Art 1
Art 43000110Art 4
Art 53000120Art 4
Art 63000130Art 4

 

I have no idea where to begin, probably due lack of DAX-syntax knowledge. Or maybe this is easier in the query editor.

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @MrMarshall,

 

You could create a calculated column with dax expression below.

 

New Column =
CALCULATE (
    MAX ( 'Order'[Description] ),
    FILTER (
        'Order',
        'Order'[OrderNumber] = EARLIER ( 'Order'[OrderNumber] )
            && 'Order'[OrderRow] = MIN ( 'Order'[OrderRow] )
    )
)

Then you will get your expected output.

 

Capture.PNG

 

Hope this can help you!Smiley Tongue

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
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

3 REPLIES 3
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @MrMarshall,

 

You could create a calculated column with dax expression below.

 

New Column =
CALCULATE (
    MAX ( 'Order'[Description] ),
    FILTER (
        'Order',
        'Order'[OrderNumber] = EARLIER ( 'Order'[OrderNumber] )
            && 'Order'[OrderRow] = MIN ( 'Order'[OrderRow] )
    )
)

Then you will get your expected output.

 

Capture.PNG

 

Hope this can help you!Smiley Tongue

 

Best Regards,

Cherry

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

Thank you! Worked perfectly 🙂 

Hi @MrMarshall,

 

It is glad that we can help. Only thing that you'll have to notice, just always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly. 

 

Best Regards,

Cherry

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

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.