• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Inverting a continuous data scale in a visualisation so largest value is at the left and smallest at the right


New Member
Hi, I just started learning Power BI. If you have an x-axis with continuous data, say 1,2,3.....10,
visuals always show 1 at the left and the largest number in this case, 10 at the right along the x axis. I want to be able to reverse this
and have 10 at the left and 1 at the far right. Easy to do in Excel but can't for the life of me do it in Power BI. It's possible to rearrange categories in a histogram visual by setting up a custom sort order but I cant reverse continuous whole number scale. No matter what I try the visual will still show smallest at the left, largest at the right. I have attached a small demo excel file. The file shows ID, opened-closed, weeks ago. So person ID 1 opened something 10 weeks ago and closed it 9 weeks ago, person ID 6 opened something 8 weeks ago and closed it 1 week ago. I can create an open closed splicer in excel and have oldest week at the left and week 1 at the right no probs. Can you help me do this in a simple power BI visual?



New Member
OK thanks for that. I will try again and produce the power bi file rather than the excel file. Sort by column wasnt working still got visualisation scale showing 0 at left and largest number on right hand side. I will play around wth that later today and double check then repost to power forum. Cheers.


Excel Ninja

One way you can do this is using "R-Code" in Power BI, here is a chart I created in reverse X axis using "ggplot". It is bit advanced power BI , but integrating R or Python with power BI will give very powerful custom visualisations.





New Member
Seriously cool and thank you so much. I never knew you could integrate R or Python with Power BI. Now I know and I have now successfully reproduced this plot with your supplied code.


Excel Ninja
While R/Python visuals are powerful, simple sorting of X category can be done by default.

You'll first need to set X axis Type to "Categorical" instead of using "Linear".

Then simply, use sort tool to sort by "Weeks Ago" & descending.

If you want to show null/non-existent value, you can simply set field property to show items with no data.