Saturday, October 22, 2022

How to sort months chronologically in Power BI

It is simple to  get order by month name wise chronologically in PowerBI but if the data comes from AAS Tabular model cube then it is really difficult to get correct order. 

The month data comes like Apr-22, Aug-22, Feb-22, Jan-22 from DIM_DATE. but ideally we want month to Chronologically like  Jan-22, Feb-22, Mar-22....................Dec-22.

Table DIM_DATE and FACT_Sales_Order  based on these two table we have to generate report month wise with format of chronologically.

Database: Azure SQL DB

Cube: Azure Analysis Services

Report : Power BI




If you are using Visual Studio for AAS(Azure Analysis services) Tabular model, 
Select DIM_DATE table first and then choose properties  the column C_Month_Year(text data type) you want display as chronologically for month select Sort By column to Month_Num column( Int data type).




You can generate reports like below sorts months chronologically.