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.
Hi everyone!
I've used the solution on adding total to a clustered chart from this thread and it worked perfectly. The only thing is that the order of columns is not OK now (see the picture below). Should be 0-2, 3-5, 6-12, etc.
Can anyone advise on how to add an index column to the calculated table 'Table', so I can sort the order of tenure categories on my chart properly?
Thanks.
Solved! Go to Solution.
Hi @Anonymous ,
One way is to add the calculated column to tooltips filed of the visual as @tex628 mentioned and click "..." on the visual then sort by calculated column.
Another way is create a custom column in Query Editor and sort the column1 by the custom column (no need to add custom column to tooltips field).
But as you said your table is a calculated table so the second way is not suitable for your current scenario but you might use it someday😁
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
One way is to add the calculated column to tooltips filed of the visual as @tex628 mentioned and click "..." on the visual then sort by calculated column.
Another way is create a custom column in Query Editor and sort the column1 by the custom column (no need to add custom column to tooltips field).
But as you said your table is a calculated table so the second way is not suitable for your current scenario but you might use it someday😁
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Depending on your data and needs you can use SWITCH() function, IF() function or RANKX() function to create a new column and sort by this column.
switch = SWITCH('Table'[Column1],"0-2",1,"3-5",2,"6-12",3)
if = IF('Table'[Column1]="0-2",1,IF('Table'[Column1]="3-5",2,3))
rank = RANKX('Table','Table'[Column1],,ASC)
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-jayw-msft,
Thanks a lot for the multiple options! Can you please check my comment on the sorting error above?
Hi,
Create a calculated column in 'Table' that looks at the different values in [State].
Use something like this:
Column =
SWITCH( [State];
"0-2" ; 0 ;
"3-5" ; 1 ;
"6-12" ; 2 ;
etc...
)
Then finally sort your [State] solumn using your new index column. Use the "Sort by column" functionality.
Br,
J
Hi @tex628!
I've used the Switch function, but when trying to apply the sorting I got the error below. Can you advise?
Thanks.
My bad, PBI doesn't like it when you try to sort a column with another one that is dependant on the first.
But the index column that we created isn't completly useless, if you drag it into the tooltip slot in the chart you can then directly sort the chart on that index column.
If you don't want to have the index column in the tooltip you will need to recreate the table in power query instead, if you do you should not get the issue when you use "sort by column".
If you need any help with setting up the table in power query, just give me the word! 🙂
Br,
J
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 |
---|---|
112 | |
97 | |
85 | |
68 | |
59 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |