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”)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.