Forum Discussion

jcastr02's avatar
jcastr02
Post Prodigy
6 years ago
Solved

Show Most recent comments

I have a list of comments that I would like to display from most recent to oldest.  In my query I have a completion time.  However, some of the comment field at times will be blank and may have repeating comments/data.  I get below error message, any help is appreciated.     

  • MFelix's avatar
    MFelix
    6 years ago

    Hi jcastr02 ,

     

    That is not possible on the table visual as a workaround you can:

    • Create a button with no backgroud and no line
    • Make the button the size of the column header and place it on top of the header
    • Group the table with the header

    That way you will still see the header of the table but if you click on it won't be reorder.

10 Replies

  • Hi jcastr02 ,

     

    On the query editor sort the table by Completion time then add an index column, then sort the comments by the index should work as intended.

      • v-gizhi-msft's avatar
        v-gizhi-msft
        Community Support

        Hi,

         

        According to your description, you can not sort the [Value] by [Completion Time] due to existing duplicate values.

        You can add an index column, and sort [Index] by [Completion Time], when you choose [Value] in visual, try to add this [index] to the visual as well and [Value] will sort by [Completion Time] because [Index] uniquely corresponds to [Value] in table.

         

        Best Regards,

        Giotto Zhi

  • smpa01's avatar
    smpa01
    Community Champion

    jcastr02 

    I assumed a dataset

     

    Column1Column2
    same value1/1/2020 10:20:00 AM
    same value1/1/2020 10:45:00 AM
    same value1/1/2020 11:00:00 AM
      
    different value1/1/2020 10:00:00 AM

     

    you can do this and display only the 1s from Index column

     

     

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKk7MTVUoS8wpTVXSUTLUN9Q3MjAyUDA0sDIyUIrVwSNvYopP3tDKAKIfKAqmUzLT0lKLUvNKsBoGUhwLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type datetime}}),
        #"Grouped Rows" = Table.Group(#"Changed Type", {"Column1"}, {{"ad", each _, type table [Column1=text, Column2=datetime]}}),
        #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each let
    X = [ad],
    Y = Table.Sort(X,{{"Column2", Order.Descending}}),
    Z = Table.AddIndexColumn(Y, "Index", 1, 1)
    in Z),
        #"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Custom"}),
        #"Expanded Custom" = Table.ExpandTableColumn(#"Removed Other Columns", "Custom", {"Column1", "Column2", "Index"}, {"Column1", "Column2", "Index"})
    in
        #"Expanded Custom"

     

     

    if you prefer DAX, a rank column might work

     

    Column = RANKX(FILTER('Table (3)',EARLIER('Table (3)'[Column1])='Table (3)'[Column1]),'Table (3)'[Column2],,ASC)