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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
heiligbd
Helper I
Helper I

Match Different Rows From Same Table In New Calculated Column

Good Day,

 

So I have a dataset that is looking at inventory metrics at multiple plants. For example, I have determined where I have a plant that is the Primary consumer of a particular material at one plant and therefore in an effort to maximize material consumption, other plants could transfer their like material to them if they are not meeting certain criteria. In the example below, I would like help solving for the "Transfer To" Column by particular material filtered. So that the other plants would know whom to send their materials to get consumed and reduce overall inventory. All of the fields shown are available and I would like a DAX solution to help on this. 

 

Thanks in advance for your help!

 

PlantMaterialRank Consumption Rank Inv TurnsTransferPrimaryTransfer To
A12311NAPrimaryNA
B12343TransferSecondaryA
C12324TransferSecondaryA
D12332TransferSecondaryA
A45623TransferSecondaryB
B45611NAPrimaryNA
C45642TransferSecondaryB
D45634TransferSecondaryB

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @heiligbd ,

 

Not sure if you want a calculated column or a measure but here is the values for both:

Calculated column:

TransferTo =
IF (
    'Table'[Transfer] <> "NA",
    MAXX (
        TOPN (
            1,
            FILTER ( 'Table', 'Table'[Material] = EARLIER ( 'Table'[Material] ) ),
            'Table'[Rank Inv Turns], ASC
        ),
        'Table'[Plant]
    ),
    'Table'[Transfer]
)

 

Measure:

TransferTo _ = 
    IF(SELECTEDVALUE('Table'[Transfer]) <> "NA",MAXX (
        TOPN (
            1,
            FILTER ( ALLSELECTED('Table'[Material], 'Table'[Rank Inv Turns],'Table'[Plant]), 'Table'[Material] = MAX ( 'Table'[Material] ) ),
            'Table'[Rank Inv Turns], ASC
        ),
        'Table'[Plant]
    ), SELECTEDVALUE('Table'[Transfer]))

MFelix_0-1679565808212.png

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

2 REPLIES 2
heiligbd
Helper I
Helper I

Awesome! Thanks for the help!

MFelix
Super User
Super User

Hi @heiligbd ,

 

Not sure if you want a calculated column or a measure but here is the values for both:

Calculated column:

TransferTo =
IF (
    'Table'[Transfer] <> "NA",
    MAXX (
        TOPN (
            1,
            FILTER ( 'Table', 'Table'[Material] = EARLIER ( 'Table'[Material] ) ),
            'Table'[Rank Inv Turns], ASC
        ),
        'Table'[Plant]
    ),
    'Table'[Transfer]
)

 

Measure:

TransferTo _ = 
    IF(SELECTEDVALUE('Table'[Transfer]) <> "NA",MAXX (
        TOPN (
            1,
            FILTER ( ALLSELECTED('Table'[Material], 'Table'[Rank Inv Turns],'Table'[Plant]), 'Table'[Material] = MAX ( 'Table'[Material] ) ),
            'Table'[Rank Inv Turns], ASC
        ),
        'Table'[Plant]
    ), SELECTEDVALUE('Table'[Transfer]))

MFelix_0-1679565808212.png

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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