cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CDiepeveen Frequent Visitor
Frequent Visitor

Sorting the x-ax by number

Hello all,

 

I have a problem with sorting the x-ax of my graph.

See the screenshot.

 

The 10 is between the 1 and the 2, however, I need the 10 to be after the 9. 

Can anyone help me with this problem?

 

Thanks in advance!

 

Regards,

Cornee

 

grafiek-voorbeeld.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Sorting the x-ax by number

@CDiepeveen you can add a number column let's call it "sort answer" for each corresponding answer and sort your existing answer column with this new "sort answer" column in modelling tab. It will give you the result you are looking for.





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

Proud to be a Datanaut! Kudos Help Smiley Happy
Connect with me on Linkedin. Feel free to email me with any of your BI needs.




 




6 REPLIES 6
Super User
Super User

Re: Sorting the x-ax by number

@CDiepeveen seems like the column you are using on x-axis is of type string, change its data type whole number and it will work.





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

Proud to be a Datanaut! Kudos Help Smiley Happy
Connect with me on Linkedin. Feel free to email me with any of your BI needs.




 




CDiepeveen Frequent Visitor
Frequent Visitor

Re: Sorting the x-ax by number

Thanks for your response parry2k.

 

However, it does not seem to be possible to change this data type.

Could this be the case when the data is uploaded in PowerBI by an self made API?

 

The data is extracted from a website with several questionaires. A single questionaire has several kind of "data-type" answers: text and numbers.

Super User
Super User

Re: Sorting the x-ax by number

@CDiepeveen are you saying that column you currently have on x-axis does also contains text for example like this.

 

1

2

3

10

11

Yes

No





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

Proud to be a Datanaut! Kudos Help Smiley Happy
Connect with me on Linkedin. Feel free to email me with any of your BI needs.




 




CDiepeveen Frequent Visitor
Frequent Visitor

Re: Sorting the x-ax by number

No, its not like that.

 

For example, the questionaire has 10 questions. 

- 2 questions with yes/no answers

- 2 questions with name/adress

- 6 questions where you give a rating from 1 to 10

 

In powerBI we made 1 table for questions with the question and a question ID.

All the answers are put in another table with the corresponding question ID.

 

In de graph I showed earlier I filtered the answers. However, the main table consists all answers.

 

Is it better to make different tables with the power query instead of using the entire table?

Super User
Super User

Re: Sorting the x-ax by number

@CDiepeveen you can add a number column let's call it "sort answer" for each corresponding answer and sort your existing answer column with this new "sort answer" column in modelling tab. It will give you the result you are looking for.





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

Proud to be a Datanaut! Kudos Help Smiley Happy
Connect with me on Linkedin. Feel free to email me with any of your BI needs.




 




Highlighted
CDiepeveen Frequent Visitor
Frequent Visitor

Re: Sorting the x-ax by number

Thank you @parry2k. We solved the problem by adding such a column.