Forum Discussion
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 according to the different years?
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.
1 Reply
- v-zhangtiCommunity Support
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.