Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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.
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.
Could someone provide a friendly nudge?
Solved! Go to Solution.
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:
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
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:
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
Hi @Anonymous ,
I suspect that Data Type of Session Order remained as Text, can you change it to whole number and try again, please? 🙂
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.
It's not in the provided picture - has the Session Order column been created successfully?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
102 | |
84 | |
79 | |
70 |
User | Count |
---|---|
120 | |
110 | |
95 | |
82 | |
77 |