Forum Discussion

abelbb's avatar
abelbb
Regular Visitor
3 years ago
Solved

ordering months

i have the above column in my dataset table and August to December represent a different year from the January to December and onwards. How do i creat a custom column that sorts the months acco...
  • v-zhangti's avatar
    3 years ago

    Hi, abelbb 

     

    You can try the following methods. In the Power Query, add index column:

    Column:

    Count = CALCULATE(COUNT('Table'[Month]),FILTER('Table',[Index]<=EARLIER('Table'[Index])&&[Month]=EARLIER('Table'[Month])))
    Date = DATEVALUE(2023-[Count]&"/"&'Table'[Month]&"/"&"1")
    Sort = YEAR([Date])*100+MONTH([Date])

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.