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.
I am using a couple graphs to show Attendance, the labels are either 'yes' or 'no'.
The 'no' is above the 'yes' label, how do I re-order this so that 'yes' comes first and above the 'no'?
Hi @Anonymous ,
Please let us know whether @Daviejoe 's method is helpful.
If it is, please accept his reply as solution to your question so that people who may have the same question can get the solution directly.
If not, please give us more details.
Best Regards,
Icey
You can add an Index column which will have Yes as 1 and No as 2.
Then sort your legend column by the index column, Yes will now be above No.
Proud to be a Super User!
@Anonymous , If they are legends. Is create then create a sort column like this
show Attendance 1 = [show Attendance]
show Attendance sort = if([show Attendance],"Yes",1,0)
Sort show Attendance 1 on show Attendance sort.
https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column
Thanks for your repluy. Can you explain exactly the formula to use?
The column I'm pulling from is 'Attended?' and the options are 'yes' and 'no'
I went to the Add Column tab, highlighted the Attended column and then selected Add Columns from Examples, I then entered a 1 against the rows that had a Yes and a 2 against those that have a No.
The Query Editor is smart so it applies this pretty quickly to the whole column.
You then order your Legend column by the newly created Index column.
Proud to be a Super User!
Thank you, I added in the new sort column with Yes=1, No-2.
Where can I find the legend order to change?
Is it different to the 'sort by' option because that does not re-order the legend.
If you follow the below steps, then the legend should sort of its own accord.
Go to your table of data and follow the steps
Proud to be a Super User!
There is no data in my data tables, I pulled straight from excel into the graphs and havent used the data tables. I did the sort by anyway to see if it would work and it didnt.
Hi @Anonymous
I'm not sure why the data isn't pulling into your Power BI Model, once the data comes into the model and you sort the Yes/No column by the Column Index then it should work as we've mapped out previously.
Once you get your data pulling into your report then it should work.
Have you changed anything in your data model to make the data not pull through?
Proud to be a Super User!
Not that I am aware of!
When I'm creating a new visual I click on the 'get data' tab and link to the excel I want to use. I don't think I've ever seen any data in those tables
Once you have pulled in your data from your Excel file you can Transform the data in the Query Editor
Here is a useful link
https://radacad.com/sort-a-column-with-a-custom-order-in-power-bi
Proud to be a Super User!
Yeah I transform the data anytime I pull in from a new spreadsheet and in the Query Editor it shows as this table. This is where I added the Sort column.
I'd also remove blank rows as the top line appears to show all Null values
Proud to be a Super User!
And your data is not showing once you've closed and applied your changes in the Query Editor?
Proud to be a Super User!
No it doesn't show in the 'data' tab on the left but it works perfectly in the 'report' view. I apply any edits I make in the query editor and they all work fine too
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 |
---|---|
98 | |
97 | |
81 | |
77 | |
66 |
User | Count |
---|---|
126 | |
105 | |
103 | |
81 | |
72 |