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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
egarstad
Frequent Visitor

DAX calc. column that displays the value from one column based on the max value in another column

Hi All,

 

I am new to DAX and have been trying to solve this problem for a few days now with no luck. I have found multiple forum posts with similar requests but none that solve my exact situation.

 

Any help would be much appreciated and thank you in advance!

 

I have the following table containing manufacturing information. An Order #, an Operation # within that Order #, and the Output Qty of that operation:

 

Table.png

 

I would like to add a DAX calculated column that, for every row, displays the Output Qty of the final operation in the order:

 

table1.png

 

I hope that makes sense. It seems like fairly straight forward logic to me but I just cannot come up with a DAX formula that works.

1 ACCEPTED SOLUTION
fhill
Resident Rockstar
Resident Rockstar

See if this works, I'm worried if you have other filters, they may impact the results...

Forrest

 

Qty - Max Op by Order = CALCULATE(
                   SUM(Table1[Qty]),
                            FILTER(Table1, Table1[Op #] = CALCULATE(
                                            MAX(Table1[Op #]),
                                           ALLEXCEPT( Table1, Table1[Order #]))),
                                           Table1[Order #] = EARLIER(Table1[Order #]))

 

image.png




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




View solution in original post

3 REPLIES 3
fhill
Resident Rockstar
Resident Rockstar

See if this works, I'm worried if you have other filters, they may impact the results...

Forrest

 

Qty - Max Op by Order = CALCULATE(
                   SUM(Table1[Qty]),
                            FILTER(Table1, Table1[Op #] = CALCULATE(
                                            MAX(Table1[Op #]),
                                           ALLEXCEPT( Table1, Table1[Order #]))),
                                           Table1[Order #] = EARLIER(Table1[Order #]))

 

image.png




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




Hi, how would be the same formula but filling only the rows with the result in the corresponding rows? like this image

Captura.PNG

Works like a charm. Thank you for the quick response!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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