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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Mareias
Frequent Visitor

Minimum row value based on visible columns

Hello,

 

I have a table like the one below, showing the minimum freight cost for a specific route based on the origin. Each origin is a different column.

 

In my database I already have the best origin for each specific route, but I want to create something more dynamic.

 

The idea was to make the Power BI recalculate the best origin based on the visible columns only.

 

For example, in a database where I have the route A, B, C, D, E and origin F1, G1, H1, I1, J1, my database shows the best route as H1:

 F1G1H1I1J1Best origin
A967875825843849H1
B947843974940825J1
C939820971960875G1
D860819986827937G1
E886853835877898H1

 

 

But, for the route A, I want power BI to consider I1 as the best origin if I remove H1 from the table

 

 F1G1I1J1Best origin
A967875843849I1

 

 

I recently found a formula that brings me the best origin, but how should I adapt it in order to make it consider only the visible columns of a table that I will create?

 

Column =
VAR temp = {
        ( "Anchor1", Table1[Anchor_1] ),
        ( "Anchor2", Table1[Anchor_2] ),
        ( "Anchor3", Table1[Anchor_3] ),
        ( "Anchor4", Table1[Anchor_4] ) }
VAR MinValue =
    MINX ( FILTER ( temp, [Value2] <> 0 ), [Value2] )
RETURN
    MINX ( FILTER ( temp, [Value2] = MinValue ), [Value1] )

Thank you

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @Mareias

Does your dataset structure as below?

2.png

 

 

Best Regards

Maggie

Mareias
Frequent Visitor

Hello,

 

I have a table like the one below, showing the minimum freight cost for a specific route based on the origin. Each origin is a different column.

 

In my database I already have the best origin for each specific route, but I want to create something more dynamic.

 

The idea was to make the Power BI recalculate the best origin based on the visible columns only.

 

For example, in a database where I have the route A, B, C, D, E and origin F1, G1, H1, I1, J1, my database shows the best route as H1:

 F1G1H1I1J1Best origin
A967875825843849H1
B947843974940825J1
C939820971960875G1
D860819986827937G1
E886853835877898H1

 

 

But, for the route A, I want power BI to consider I1 as the best origin if I remove H1 from the table

 

 F1G1I1J1Best origin
A967875843849I1

 

 

I recently found a formula that brings me the best origin, but how should I adapt it in order to make it consider only the visible columns of a table that I will create?

 

Column =
VAR temp = {
        ( "Anchor1", Table1[Anchor_1] ),
        ( "Anchor2", Table1[Anchor_2] ),
        ( "Anchor3", Table1[Anchor_3] ),
        ( "Anchor4", Table1[Anchor_4] ) }
VAR MinValue =
    MINX ( FILTER ( temp, [Value2] <> 0 ), [Value2] )
RETURN
    MINX ( FILTER ( temp, [Value2] = MinValue ), [Value1] )

Thank you

Helpful resources

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

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors