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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Spotto
Helper IV
Helper IV

MINX IN POWER QUERY (easy to solve)

Hello everyone, I need to do in power query the choice of min value in a column (value) and return the corresponding description but I'm not getting it,

thank you all for the help

 

Spotto_3-1663624894168.png

 

Spotto_2-1663624866174.png

 

Spotto_4-1663624921954.png

 

let
Fonte = Excel.Workbook(File.Contents("C:\Users\m071410\Downloads\teste19-09.xlsx"), null, true),
Tabela1_Table = Fonte{[Item="Tabela1",Kind="Table"]}[Data],
#"Tipo Alterado" = Table.TransformColumnTypes(Tabela1_Table,{{"CONTRATO", type text}, {"HORAS", type text}, {"DATA", Int64.Type}}),
#"Colunas Renomeadas" = Table.RenameColumns(#"Tipo Alterado",{{"DATA", "VALUE"}, {"HORAS", "DESCRIPTION"}, {"CONTRATO", "CONTRACT"}}),
#"Linhas Agrupadas" = Table.Group(#"Colunas Renomeadas", {"CONTRACT"}, {{"VALUE", each List.Min([VALUE]), type nullable number}, {"table", each _, type table [CONTRACT=nullable text, DESCRIPTION=nullable text, VALUE=nullable number]}})
in
#"Linhas Agrupadas"

 

 

Example pbix 

2 ACCEPTED SOLUTIONS
jbwtp
Memorable Member
Memorable Member

Hi @Spotto,

 

I think you are following this one:

Solved: Select rows on minimum value in Power Query - Microsoft Power BI Community

 

What you nee dto do next is expanding the table column and thne filter on [VALUE] = [MinVALUE].

 

Cheers,

John 

View solution in original post

v-jingzhang
Community Support
Community Support

Hi @Spotto 

 

Try this 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("RY4xDgAhCAT/Ym2l3vUYCPVpYWH8/zdkORMp2GXCEuYMRCFaI9eUU1jxQLZS01weh7XaIDKA8iWd1JNOmHFNWEnMnKDAy/isvz9RkKbasFTKZZ0Ea3hjbQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [CONTRACT = _t, DESCRIPTION = _t, VALUE = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"CONTRACT", type text}, {"DESCRIPTION", type text}, {"VALUE", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"CONTRACT"}, {{"All Data", each _, type table [CONTRACT=nullable text, DESCRIPTION=nullable text, VALUE=nullable number]}, {"Min Value", each List.Min([VALUE]), type nullable number}}),
    #"Expanded All Data" = Table.ExpandTableColumn(#"Grouped Rows", "All Data", {"DESCRIPTION", "VALUE"}, {"DESCRIPTION", "VALUE"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded All Data", each [VALUE] = [Min Value]),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Min Value"})
in
    #"Removed Columns"

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @Spotto 

 

Try this 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("RY4xDgAhCAT/Ym2l3vUYCPVpYWH8/zdkORMp2GXCEuYMRCFaI9eUU1jxQLZS01weh7XaIDKA8iWd1JNOmHFNWEnMnKDAy/isvz9RkKbasFTKZZ0Ea3hjbQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [CONTRACT = _t, DESCRIPTION = _t, VALUE = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"CONTRACT", type text}, {"DESCRIPTION", type text}, {"VALUE", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"CONTRACT"}, {{"All Data", each _, type table [CONTRACT=nullable text, DESCRIPTION=nullable text, VALUE=nullable number]}, {"Min Value", each List.Min([VALUE]), type nullable number}}),
    #"Expanded All Data" = Table.ExpandTableColumn(#"Grouped Rows", "All Data", {"DESCRIPTION", "VALUE"}, {"DESCRIPTION", "VALUE"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded All Data", each [VALUE] = [Min Value]),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Min Value"})
in
    #"Removed Columns"

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

jbwtp
Memorable Member
Memorable Member

Hi @Spotto,

 

I think you are following this one:

Solved: Select rows on minimum value in Power Query - Microsoft Power BI Community

 

What you nee dto do next is expanding the table column and thne filter on [VALUE] = [MinVALUE].

 

Cheers,

John 

Helpful resources

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

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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