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