Calendar Tables, Sort Columns and Role-Playing Dates
Understand it in simple language
A calendar provides one unique row per day with no gaps over the required period. Marking a date table and using its columns consistently supports conventional time intelligence. Month names sort alphabetically unless sorted by month number; year-month labels need a year-month key.
Sales can have OrderDate and ShipDate. Only one relationship between the same table pair can be active at a time. Use a separate role-playing date dimension or a deliberate USERELATIONSHIP measure for alternate dates.
Do it step by step
Create this calculated table:
Date = CALENDAR(DATE(2024,1,1), DATE(2025,12,31))
Add Year = YEAR('Date'[Date]), MonthNo = MONTH('Date'[Date]), and Month = FORMAT('Date'[Date], "MMM"). Select Month > Sort by column > MonthNo. Mark as date table using Date. Relate Date[Date] to Sales[OrderDate], one-to-many, Single. Use Date fields in slicers.
Check your result
Check the date table has 731 rows because 2024 is a leap year, and no duplicate dates.
If something goes wrong
A timestamp that includes a time may not match a midnight date. Create a date-only key for the relationship.
Practice data and learning method
Industry practice collection: downloadable retail, finance, HR and operations datasets, dictionaries, full walkthroughs and answer sheets. The cases contain multiple years, multiple related tables, deliberate data defects and known-answer checks. Progress from the small foundation files below to these cases; do not reuse the foundation totals for the larger datasets.
Download Sales.csv, Products.csv, and the dataset guide. These files contain synthetic training data, not real customers. Use the Power BI virtual labs for guided browser practice. Each lab states its supported operations. Then repeat the procedure above in the actual Microsoft tools and save evidence of your result. Try another filter or an intentionally incorrect setting and explain what changed before moving on.
Guided practicals for this topic
Virtual lab · Microsoft Power BI · 35 min
Sort a 36-month revenue report chronologically
Hands-on retail case: load the downloadable CSV tables, perform the actions, inspect the full-data result and reconcile it. Includes a paired Desktop procedure.
Continue learning from Microsoft
Power BI documentation · DAX reference · Power Query M reference · Power BI analyst skills map. Features, licensing, menus and availability can change; check the relevant official page for your environment.
Practise this topic
Hands-on virtual lab
Apply what you just read in a realistic, guided simulation. Free with a verified account.
Create a free account to track your progress and unlock virtual labs.