question

deannapi-8999 avatar image
0 Votes"
deannapi-8999 asked CarrinWu-MSFT edited

Order By in VS to send to Power BI

I have a date column in my table and then another column to extract the name of the month of the date column.
Example:
Date Month_Name
01/21/2021 January
03/05/2021 March
08/04/2021 August

I used the following script:

"Extracted Month Name" = Table.TransformColumns(#"Filtered Rows", { {"Month_Name", each Date.MonthName(_), type text}})


When I populate my Power BI dashboard and bring in the Month_Name column, it is not ordering by date, it's ordering alphabetically.
(August, January, March)
How can I use ORDER BY in VS? I cannot edit in PBI since I'm using SQL Server in VS.

power-query-not-supported
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @deannapi-8999, welcome to Microsoft Q&A! Kindly suggest that please post your question in Power BI forum as @LeonLaude mentioned. And could you please do "Accept Answer" if below answers help you? By doing so, it will benefit for community members who have this similar issue. Your contribution is highly appreciated. Thank you!

0 Votes 0 ·
LeonLaude avatar image
1 Vote"
LeonLaude answered LeonLaude edited

Hi @deannapi-8999,

They're also actively answering in the dedicated Power BI forum over here:
https://community.powerbi.com/t5/Forums/ct-p/PBI_Comm_Forums


If the reply was helpful please don't forget to upvote and/or accept as answer, thank you!


Best regards,
Leon

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

dgosbell avatar image
0 Votes"
dgosbell answered

When I populate my Power BI dashboard and bring in the Month_Name column, it is not ordering by date, it's ordering alphabetically.
(August, January, March)
How can I use ORDER BY in VS? I cannot edit in PBI since I'm using SQL Server in VS.

To fix this create a second column in your table with the month number (you can hide this column from the users if you like)

The set the sort by property of your Month_Name column to use this new Month_Number column. Power BI and other client tools should then use this column to sort the Month_Name values.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.