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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
jcastr02
Post Prodigy
Post Prodigy

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.     Sorting.png

1 ACCEPTED SOLUTION

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.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

10 REPLIES 10
smpa01
Super User
Super User

@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)

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
MFelix
Super User
Super User

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.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



@MFelix  I tried that earlier too, but I still get same error 😞

 

Index.png

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

https://1drv.ms/u/s!Ava_12t7CNJtkEcQHD-Ralk-Qgjf?e=Mt56rq 

 

I added it to my visual, but still keeps it in alphabetical order.  I've attached my BI file as well.  Please see 'duplicate of 60 day tab'

trying to work on visual with green background.  

 

https://1drv.ms/u/s!Ava_12t7CNJtkEcQHD-Ralk-Qgjf?e=Mt56rq

 

@v-gizhi-msft @smpa01   Tried both of your solutions but can't seem to have it sort by completion time.  

Hi @jcastr02 , 

 

Best option is what you have done in your visualization so placing the comment and index on your table then turn off wrap text on title and sort the table by index then just hide the index column by reducing it's size.

 

A workaround but it works.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



@MFelix Yes ! this seems to work!   I appreciate the help.  Only thing I noticed that repeating items such as N/A, pay, the hours, etc. are pushed to the top so everything else sorts except the repeating items, any work around you are aware of?Dont Summarize.png

Hi @jcastr02 ,

 

Make the summarization of the index column the miminum value and then sort it out. what is happening is that the default behavior of ID is to sum values since you have more than one values for certain comments they get to different positions based on its sum.

 

If you select minimum you will get the first value of the index.

 

for example NA in your table is giving the 299 (sum of several index) making it to minimum it gives 17 if you go to your table the first record with NA is line 18 at 17/01/2020 so the first one as you want.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



@MFelix You are awesome that worked! One last ?   How can I hide the sorting arrow.  From end user perspective if they click on the visual, it will sort by Value again

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.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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