Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hey,
I want to sort a X-axis from a line and clustered column Chart (variable sortedChart) and show only another column call (values) is it possible??
Solved! Go to Solution.
Hi,@guy17829393.Hello, @parry2kThank you very much for your help on this issue, now I want to share my solution below .
I am glad to help you.
According to your description, you are trying to implement a sorting function for the x-axis of a line/bar chart, right.
In response to your later question "show only another column call (values) is it possible?", could you elaborate a bit more on what you mean?
Could you elaborate a bit more on what you mean, if you can provide me with non-sensitive data, it would be very helpful in solving your problem.
Here are the results of my test, I hope it can help you.
Normally, if the data in the X-axis is simple data, such as data type, date type, then Power BI Desktop can sort it by default. However, you can customize the index columns and sort the X-axis based on the custom columns
My test data is as follows.
1. Create a new custom sorting column: C_sortIndex
C_sortIndex =
SWITCH(TRUE(),
test_data[x_Name]="A",1,
test_data[x_Name]="B",2,
test_data[x_Name]="C",3,
test_data[x_Name]="E",4,
test_data[x_Name]="D",5
)
2. Relying on the X-axis stored columns to re-create a calculated column, so that the value of the same, so as to avoid direct use of the X-axis based on the creation of the column C_sortIndex sorting circular dependency problems:
PS: Sorting directly on the original columns of the X-axis will cause a circular dependency problem.
Here's the right way to do it.
x_sortValue = 'test_data'[x_Name]
3. Sort the newly created column “x_sort” using the created index column ordering.
4. Re-create visual, the realization of the bar chart in the X-axis by customizing the order of the columns to be sorted.
I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,@guy17829393.Hello, @parry2kThank you very much for your help on this issue, now I want to share my solution below .
I am glad to help you.
According to your description, you are trying to implement a sorting function for the x-axis of a line/bar chart, right.
In response to your later question "show only another column call (values) is it possible?", could you elaborate a bit more on what you mean?
Could you elaborate a bit more on what you mean, if you can provide me with non-sensitive data, it would be very helpful in solving your problem.
Here are the results of my test, I hope it can help you.
Normally, if the data in the X-axis is simple data, such as data type, date type, then Power BI Desktop can sort it by default. However, you can customize the index columns and sort the X-axis based on the custom columns
My test data is as follows.
1. Create a new custom sorting column: C_sortIndex
C_sortIndex =
SWITCH(TRUE(),
test_data[x_Name]="A",1,
test_data[x_Name]="B",2,
test_data[x_Name]="C",3,
test_data[x_Name]="E",4,
test_data[x_Name]="D",5
)
2. Relying on the X-axis stored columns to re-create a calculated column, so that the value of the same, so as to avoid direct use of the X-axis based on the creation of the column C_sortIndex sorting circular dependency problems:
PS: Sorting directly on the original columns of the X-axis will cause a circular dependency problem.
Here's the right way to do it.
x_sortValue = 'test_data'[x_Name]
3. Sort the newly created column “x_sort” using the created index column ordering.
4. Re-create visual, the realization of the bar chart in the X-axis by customizing the order of the columns to be sorted.
I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@guy17829393 sorry your question is not fully clear, could you please provide more details?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
User | Count |
---|---|
96 | |
86 | |
78 | |
72 | |
67 |
User | Count |
---|---|
110 | |
104 | |
84 | |
65 | |
63 |