Forum Discussion
neeharikathota
5 years agoFrequent Visitor
Sorting months in Power BI using sort table
Hi All , Iam facing a issue while trying to sort my date column in calender sequence . My actual date column is in the format MMMYY Dec19,Jan20,Feb20 etc., user wants to see aggregated SWAP valu...
- 5 years ago
neeharikathota
Go to Power Query, Select the column that has dates like "DEC19", RIGHT-CLICK > Change Type > select Date. Now you can do the formatting in the data model as MMMYY.
Let me know if need further help on this.________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
Anonymous
5 years agoNot applicable
try this
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSk/NU9JRMjRUitWJVkosKAJyjIzAnJTMZCDH2BjMSUtNAnJMkFSZgtnpmaVAthmYnVOaDmSbg9n5JSVAtoVSbCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [idx = _t, val = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"idx", type text}, {"val", Int64.Type}}),
ttr=Table.ToRecords(#"Changed Type"),
mesi=Record.FromList({1..12},List.Transform({1..12}, each Text.Start(Date.MonthName(#date(2020,_,1)),3)))
in
Table.FromRecords(List.Sort(ttr, (x,y)=>Value.Compare(Record.Field(mesi,x[idx]),Record.Field(mesi,y[idx]))))