BlogPower BI

Sort by Year – Week in Power BI

In Power BI, if you are creating year-week sales report, then you will encounter a most common issue. i.e Power BI by default return single digit week number/month number.

Default Sorting in Power BI:


But desired results is:
2018-12
2018-11
2018-09
2017-01

Using this formula once can fix this problem:

Year-Month= Data[a_date].[Year]&”-“&FORMAT(Data[a_date].[MonthNo],”00″)

Year-Week= Data[a_date].[Year]&”-“&FORMAT((Data[a_date].[MonthNo],1),”00”)