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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
callum
Helper II
Helper II

Data loses order on publishing to web

Hello,

 

Here's what my data looks like in the data pane:

 

Capture.PNG

As you can see, it's sorted by ringNumber (how it sorts rows with a equal ringNumber doesn't matter).

 

However, when I publish this to the web, the data is in a seemingly random order (as I'm developing a custom visual, specifically it's dataViews[0].table.rows that is unsorted, although I think this isn't particularly relevant to the question).

 

I've checked and the order given is not even that of the data in the Query editor, and I can't actually seem to spot any kind of order in the data. Is it just random? How can I preserve order when publishing to web?

 

Thank you.

6 REPLIES 6
v-ljerr-msft
Employee
Employee

Hi @callum,


I've checked and the order given is not even that of the data in the Query editor, and I can't actually seem to spot any kind of order in the data. Is it just random? How can I preserve order when publishing to web?


Have you tried using Table.Sort function(M) to sort your table by ringNumber column in Query Editor? Based on my understand and test, it should work in your scenario. Smiley Happy

= Table.Sort(#"PreviousStepName",{{"ringNumber", Order.Ascending}})

sortrows.PNG

 

Regards

Thanks for the idea, unfortunately ring number is a calculated column in DAX so M is not a solution!

Hi @callum,

 

What's the logic of creating the ring number column? I'm just wondering if you could create a custom/conditional column for ring number within Query Editor using M instead, then the solution could work? Smiley Happy

 

Regards

Hi,

 

Basically, my visual looks like this: Capture.PNG

(Basically a Power BI version of Thoughtworks' Tech Radar)

 

So each "point" on the visual is a row in the dataset, and has a "ring" column which is either "Accelerate", "Progress", "Monitor" or "Pause". I'd like to be able to specify the order the rings are plotted in, i.e. Accelerate is the inner circle, Pause is the outer ring, etc.

 

At the moment I'm hardcoding these values into my visual's code, but obviously this is a very inflexible solution as it doesn't allow any modifications!

 

I've just tried your M method - it does work in Power BI desktop, but on uploading to the web, the data provided to the visual still seems to be in a random order.

 

Perhaps this is more of a visual development issue rather than an M/DAX/PBI Desktop issue then? I'll see if there's any ideas in the Development forum.

Greg_Deckler
Super User
Super User

I would think you would order it when you retrieve it into your custom visual. Generally, the order of the data is not important and you do your sorting within the visualization. Why does the order of the raw data matter?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Because in my visual I wish to enable the user to have a say in how it gets rendered, e.g. the rows that are first in the dataset get rendered first. Is there no way of achieving this then?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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