Forum Discussion

cross1987's avatar
cross1987
Regular Visitor
2 years ago

Adding a custom column to allow a filter in Table.profile

At present I have a table of data, made up of several sources: A,B,C & D that have issues assigned to them.

What I want to be able to do is use the Table.Profile capability to profile the data so I can see the min, max, etc etc - this part is fine, what I am struggling with is adding a custome column to this to allow me to filter the min max etc by source:

Source Column (which the table is filterable by) then have the table.profile columns of the column, Min, Max etc

2 Replies

  • edhans's avatar
    edhans
    Community Champion

    Not sure what you are getting at. A screenshot of a mockup would help. However, you can add custom aggregations to Table.Profile.

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTJUitWBsIzgLGMwywnIMoGzTOEsM6XYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Source = _t, Value = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Value", Int64.Type}}),
        Custom1 = 
            Table.Profile(
                #"Changed Type",
                { 
                    {"Median", each Type.Is(_, type nullable number), List.Median},
                    {"Mode", each Type.Is(_, type nullable number), List.Mode} 
                }
            )
    in
        Custom1

     

    Turns this:

    into this

    How to use M code provided in a blank query:
    1) In Power Query, select New Source, then Blank Query
    2) On the Home ribbon, select "Advanced Editor" button
    3) Remove everything you see, then paste the M code I've given you in that box.
    4) Press Done
    5) See this article if you need help using this M code in your model.

     

    If you need more help, please provide more info per below:

    How to get good help fast. Help us help you.

    How To Ask A Technical Question If you Really Want An Answer

    How to Get Your Question Answered Quickly - Give us a good and concise explanation
    How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.

  • Anonymous's avatar
    Anonymous
    Not applicable

    You could group your a, b, c, d, and then choose the All Rows aggregation. Then you could add a custom column with each Table.Profile(_[TableColumn]))

     

    --Nate