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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Sort Category

Hi Power BI Community,

 

I have what seems like a trivial request - sort category.

 

Session is my category. In theory, Session is sorted in ascending order. However, sessions 10, 11, Aysnch are not following the rule. 

 

quipmaster_1-1661277315814.png

 

I've created a conditional column to sort. 

= Table.AddColumn(#"Changed Type", "Session Order", each if [Session] = 1 then 1 else if [Session] = 2 then 2 else if [Session] = 3 then 3 else if [Session] = 4 then 4 else if [Session] = 5 then 5 else if [Session] = 6 then 6 else if [Session] = 7 then 7 else if [Session] = 8 then 8 else if [Session] = 9 then 9 else if [Session] = 10 then 10 else if [Session] = 11 then 11 else if [Session] = 12 then 12 else 13)

 

I've sorted Session by Session Order but it is not working as intended. 

 

quipmaster_2-1661277420643.png

 

 

Could someone provide a friendly nudge?

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

HI @Anonymous ,

Pls test the below:

= Table.AddColumn(#"Changed Type", "ession Order", each if [Session] = "1" then 1 else if [Session] = "2" then 2 else if [Session] = "3" then 3 else if [Session] = "4" then 4 else if [Session] = "5" then 5 else if [Session] = "6" then 6 else if [Session] = "7" then 7 else if [Session] = "8" then 8 else if [Session] = "9" then 9 else if [Session] = "10" then 10 else if [Session] = "11" then 11 else if [Session] = "12" then 12 else 13)

Output:

vluwangmsft_0-1661499725863.png

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.And if your question still not solved ,pls share your pbix file.

 

 

Best Regards,
Lucien

View solution in original post

4 REPLIES 4
v-luwang-msft
Community Support
Community Support

HI @Anonymous ,

Pls test the below:

= Table.AddColumn(#"Changed Type", "ession Order", each if [Session] = "1" then 1 else if [Session] = "2" then 2 else if [Session] = "3" then 3 else if [Session] = "4" then 4 else if [Session] = "5" then 5 else if [Session] = "6" then 6 else if [Session] = "7" then 7 else if [Session] = "8" then 8 else if [Session] = "9" then 9 else if [Session] = "10" then 10 else if [Session] = "11" then 11 else if [Session] = "12" then 12 else 13)

Output:

vluwangmsft_0-1661499725863.png

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.And if your question still not solved ,pls share your pbix file.

 

 

Best Regards,
Lucien

coskuersanli
Resolver III
Resolver III

Hi @Anonymous ,

 

I suspect that Data Type of Session Order remained as Text, can you change it to whole number and try again, please? 🙂

Anonymous
Not applicable

Hi HotChilli,

 

Thank you for your reply. I believe the column has been created successfully. Here is a screenshot. 

 

Please let me know if you need anything else.

 

quipmaster_1-1661278906571.png

 

 

HotChilli
Super User
Super User

It's not in the provided picture - has the Session Order column been created successfully?

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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