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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
RoydenC
New Member

Data Profile: Min and Max Text Length

Hello I am currently profiling my data using the Table.Profile() function and it's working. My issue is that I also need it to provide me the min and max length of the text in the data.

 

This works as intended.

 

 

= Table.Profile(My_Table, {
        {"Median", each Type.Is(_, type nullable number), List.Median},
        {"Mode_Number", each Type.Is(_, type nullable number), List.Mode},
        {"Mode_Text", each Type.Is(_, type nullable text), List.Mode},
        {"Mode_Date", each Type.Is(_, type nullable date), List.Mode},
    }
)

 

 

 

What I'm trying to do in the next piece of code is get the text length of each record and get the min text length. I'm a bit weak with lists and the below code doesn't work.

 

 

= Table.Profile(My_table, {
{"Median", each Type.Is(_, type nullable number), List.Median},
{"Mode_Number", each Type.Is(_, type nullable number), List.Mode},
{"Mode_Text", each Type.Is(_, type nullable text), List.Mode},
{"Mode_Date", each Type.Is(_, type nullable date), List.Mode},
{"Min Len" , each Type.Is(_, type nullable text), List.Min(Text.Length(each ))}
}
)

 

 

 

The alternative is me duplicating the data set, creating a new colum for each indifidual column in a table and getting the length, removing the original columns, renaming the length columns with the original column names and then merging the columns with the master data profile. This is a rather tedious task when you have multiple tables and multiple columns within a table. I am hoping there is a better way.

 

The data profile viewer shows the min/max text length of the data so not sure why the Table.Profile function doesn't or if I'm misisng something with the Table.Profile function.

1 ACCEPTED SOLUTION
ronrsnfld
Super User
Super User

You need to create a List of the lengths in order to apply the LIst.Min or List.Max functions

 

profile = Table.Profile(#"Table to Profile", {
        {"Max Text Length", each Type.Is(_, type nullable text), each List.Max(List.Transform(_, each Text.Length(_)))},
        {"Min Text Length", each Type.Is(_, type nullable text), each List.Min(List.Transform(_, each Text.Length(_)))}
        })

 

 

 

View solution in original post

2 REPLIES 2
ronrsnfld
Super User
Super User

You need to create a List of the lengths in order to apply the LIst.Min or List.Max functions

 

profile = Table.Profile(#"Table to Profile", {
        {"Max Text Length", each Type.Is(_, type nullable text), each List.Max(List.Transform(_, each Text.Length(_)))},
        {"Min Text Length", each Type.Is(_, type nullable text), each List.Min(List.Transform(_, each Text.Length(_)))}
        })

 

 

 

Thank you for taking the time to post the solution and an explanation. It worked wonderfully. Much appreciated!

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors