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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
evalromf
Helper I
Helper I

Sort table strings

Hi,

 

I'm trying to add a text into a table visual. The text for this table should be imported from a text file, in order to give an user the possibility to enter the text without having to go in to Power BI.

 

Wanted result:

this should be the first string

and not this one

neither this

 

However, the visual sorts on the first letter of the strings, and not the order they were entered into the imported file:

and not this one

neither this

this should be the first string

 

When reading the tutorials, I have only found the instruction to use the "..." at the top right - but that gives me only the possibilities to export data or remove the table. (is that really correct?)

 

Hence, I've created a "row number" column in the .txt file for ordering the strings in the order they should appear. I've created a new column containing just this number (as "row order" column)

 

Then I have sorted the rows based on this column:

 

No       Text string                                  Row order

--         -----------                                   ------------

1          this should be the first string     1

2          and not this one                         2

3          neither this                                 3 

 

But this does not give the possibility to sort the table properly, as I do no want to have the order column visible in the table.

 

Does anyone have an idea on how to solve this? Any feedback would be highly appreciated. And feel free to provide a compelety different way to get text into a visual 🙂

 

Thanks in advance, Eva-Lotta

2 ACCEPTED SOLUTIONS

@evalromf

 

In this scenario, if you don't want to sort the value in alphabet order, you must have an sort number column (like your Index column). You can have the TextString column sort by that index column and you don't need to put the index column into table visual at all. Just click the TextString field, then select the index column in "Sort by Column".

 

3.PNG

33.PNG

Regards,

View solution in original post

Using your new text, I'm able to get the correct sort using my steps.  Do you have the latest version of the Desktop program?  What does the Order by look like within the Modeling tab?

 

This is what I started with:

sort1.png

 

This is the modeling tab:

sort2.png

 

And this is the visualization:

sort3.png

 

Additionally, if you want to use the long sentence and word wrap, you can use the custom visualization LongTextVisualizer: https://app.powerbi.com/visuals/

 

HTH,

Jessica

View solution in original post

7 REPLIES 7
jessicammoss
Advocate I
Advocate I

Hi Eva-Lotta,

 

You can sort the data by going to the Table view, Modeling tab, Sort By Column, as shown in the below picture.

 

Also, if you'd rather not add a row number in the text file, you can do that within Power BI by adding an Index column within the Query Editor > Add Column tab > Add Index Column.

 

HTH,

Jessica

 

powerbi-sort.png

HI Jessica,

 

And thanks for your propsed solution!

 

However, it does not really give me the result I'm after. This is what I have done in modelling:

 

Capture.JPG

 

And this is what the table visualization look like:

 

Capture2.JPG

If I keep the Index column as visible in the Table visual, I can sort on that. But I don't want to display the index.

 

Did I interpret your suggested solution correctly?

 

//Eva-Lotta

Using your new text, I'm able to get the correct sort using my steps.  Do you have the latest version of the Desktop program?  What does the Order by look like within the Modeling tab?

 

This is what I started with:

sort1.png

 

This is the modeling tab:

sort2.png

 

And this is the visualization:

sort3.png

 

Additionally, if you want to use the long sentence and word wrap, you can use the custom visualization LongTextVisualizer: https://app.powerbi.com/visuals/

 

HTH,

Jessica

The LongTextVisualizer is really great, thanks for recommending that! It really made my day 🙂

 

//Eva-Lotta

@evalromf

 

In this scenario, if you don't want to sort the value in alphabet order, you must have an sort number column (like your Index column). You can have the TextString column sort by that index column and you don't need to put the index column into table visual at all. Just click the TextString field, then select the index column in "Sort by Column".

 

3.PNG

33.PNG

Regards,

Now, I got it to work! I missed to select the TextString column before Sort by feature.

 

My data submittors will be very happy to be able to enter their comments in a text file, as they are a bit old school 🙂 

 

Thanks!

Eva-Lotta

 

I can also add that having the comments as a long text string instead of several different rows does not work (for me, at least). This leads to a "wide" table with a scroll bar, no page breaks.

 

Capture3.JPG

 

It seems like there is no built-in feature to add word wrap yet: "We are starting to look into adding word wrap to tables, matrices and cards. While we don’t yet have a date to give you, I wanted to let you know that we are listening and we are starting to investigate this feature." (written in august)

 

//ELR

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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