cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Create a new Table to show the Minimum value based on multiple criteria

I'm trying to create a new Table to just have the minimum cost carrier based on 3 criteria - Origin Zip, Destination Zip, Mode 

This is my initial data:

1.PNG

 

I'm looking for end result to be similar to this:

2.PNG

Thanks 

1 ACCEPTED SOLUTION

@Anonymous

 

Another way..Shorter Code

 

Calculated Table 1 =
GENERATE (
    SUMMARIZE (
        Table1,
        [3 digit Origin Zip],
        [3 digit Destination Zip],
        [Mode],
        "Lowest Rate", MIN ( Table1[Rate] )
    ),
    SELECTCOLUMNS ( FILTER ( Table1, [Rate] = [Lowest Rate] ), "Carrie", [Carrier] )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

6 REPLIES 6
Zubair_Muhammad
Super User
Super User

@Anonymous

 

One way is to have calculated table from modelling tab

 

Calculated Table =
ADDCOLUMNS (
    SUMMARIZE (
        Table1,
        [3 digit Origin Zip],
        [3 digit Destination Zip],
        [Mode],
        "Lowest Rate", MIN ( Table1[Rate] )
    ),
    "Carrier", CALCULATE (
        MIN ( Table1[Carrier] ),
        TREATAS (
            { ( [3 digit Origin Zip], [3 digit Destination Zip], [Mode], [Lowest Rate] ) },
            Table1[3 digit Origin Zip],
            Table1[3 digit Destination Zip],
            Table1[Mode],
            Table1[Rate]
        )
    )
)

Regards
Zubair

Please try my custom visuals

@Anonymous

 

Another way..Shorter Code

 

Calculated Table 1 =
GENERATE (
    SUMMARIZE (
        Table1,
        [3 digit Origin Zip],
        [3 digit Destination Zip],
        [Mode],
        "Lowest Rate", MIN ( Table1[Rate] )
    ),
    SELECTCOLUMNS ( FILTER ( Table1, [Rate] = [Lowest Rate] ), "Carrie", [Carrier] )
)

Regards
Zubair

Please try my custom visuals
Anonymous
Not applicable

Works like a Charm! Thanks @Zubair_Muhammad

@Anonymous

 

...and another one:

 

ResultTable =
FILTER (
    Table1;
    Table1[Rate] = CALCULATE ( MIN ( Table1[Rate] ); ALL ( Table1[Rate]; Table1[Carrier] ) )
)
Anonymous
Not applicable

@AlB (I'm not a DAX expert) When I used the one you posted it gives me all the values rather than Just least cost carrier.

@Anonymous

 

Maybe you did something differently. It should work.

Check it out in this file. It yields exactly the same result as you showed above.

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors