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
o59393
Post Prodigy
Post Prodigy

How to sort a graph by ascending order

Hi all

 

I need to sort a graph in descending order, the problem I have is that it recognizes for example a 15 before a 2, must be because it starts with 1.

 

As seen in the red graphs it starts with 10, 11, and so on.

 

 

sort1.PNG

 

sort2.PNG

 

Above is the table I use, how can i correctly sort by ascending order?

 

Thanks!!

1 ACCEPTED SOLUTION

HI @o59393 

Just add just the model as below:
Step1:

Use this formula to create Total Sanitary Reg Time Interval column

Total Sanitary Reg Time Interval = calculate(FIRSTNONBLANK(dimIntervals[Label],1),FILTER(dimIntervals,dimIntervals[MinPeriod]<(Ticket[*Department time]+Ticket[Cycle Time (Process)]+Ticket[*Submission to government]) && dimIntervals[MaxPeriod]>=(Ticket[*Department time]+Ticket[Cycle Time (Process)]+Ticket[*Submission to government]) ))

Step2:

Create a relationship between 'Ticket' table and 'dimIntervals' table

8.JPG

 

Step3:

Now set sort by column and when you create visuals, use [Label] instead of [Total Sanitary Reg Time Interval]

9.JPG

 

and here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
Tahreem24
Super User
Super User

It is happening because your label column is text.

Well, you should create an index column by applying the below steps:
1. go to query editor ans select your Label Column then go to Add column menu and select Index Column. So it will automatically creates index column for starting with 0. Apply and close query editor.
2. Go to Data view tab from left most panel and select Label Column then go to modelling menu then choose Sort by column option and check mark the Index Column.

Don't forget to give thumbs up 👍and accept this as a solution if it helps you.
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Hi @Tahreem24  and @TomMartens 

 

When I create the index column and I select to sort by index in the label column the visuals crash:

sort4.png

sort5.PNG

 

How can I fix it ?


Thanks.

 

 

I added the index to the visual and went from this:

 

 

sort7.PNG

 

To this:

 

sort6.PNG

 

I am getting everything with 100% when it should be the count of times as seen in the statement of the problem, how can I correct it?

 

Thanks!

I attach the pbix, it contains the index column

 

https://1drv.ms/u/s!ApgeWwGTKtFdhiTj1pBzxG_8LkDW?e=SQDJ4f

 

In case you want to look and see the problem

 

Thanks 🙂

HI @o59393 

Just add just the model as below:
Step1:

Use this formula to create Total Sanitary Reg Time Interval column

Total Sanitary Reg Time Interval = calculate(FIRSTNONBLANK(dimIntervals[Label],1),FILTER(dimIntervals,dimIntervals[MinPeriod]<(Ticket[*Department time]+Ticket[Cycle Time (Process)]+Ticket[*Submission to government]) && dimIntervals[MaxPeriod]>=(Ticket[*Department time]+Ticket[Cycle Time (Process)]+Ticket[*Submission to government]) ))

Step2:

Create a relationship between 'Ticket' table and 'dimIntervals' table

8.JPG

 

Step3:

Now set sort by column and when you create visuals, use [Label] instead of [Total Sanitary Reg Time Interval]

9.JPG

 

and here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
TomMartens
Super User
Super User

Hey @o59393 ,

 

you have to create an index column and then use this column to sort the column label by this new column.

This article describes how you can sort the label column by another column: https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column

 

Hopefully this provides what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
MFelix
Super User
Super User

Hi @o59393,

Click on the label colum and then on the column options select the sort by and select one of the other two columns since they are numbers it will give you expected result.

Regards,
MFelix

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



Hi @MFelix 

 

Kinda lost, yoiu mean here?

 

sort3.png

 

thanks.

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.