Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Dear All,
I am new to Power Bi, Looking to generte a master calendar with following fields via DAX or Power Query.
My requirement:-
Start Date = Min (Date) from the dataset
End Date = Max (Date) from the dataset.
based on the dates from Dataset, i would like to generate below fields for my data analysis. I want to link these dates from the Mastercalendar into my data set like Table A and Table B which has a Date field.
Required Fields:
Date --> DD-MM-YYYY
Month-Year --> MMM-YYYY or MMM-YY
Month Name --> MMM
Day --> DD
Quarter --> Q1, Q2, Q3 etc.
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
Calendar =
VAR _startdate =
DATE ( 2023, 1, 1 ) // or, mindate from the fact table
VAR _enddate =
DATE ( 2024, 12, 31 ) // or, maxdate from the fact table
VAR _t =
ADDCOLUMNS (
CALENDAR ( _startdate, _enddate ),
"Year", YEAR ( [Date] ),
"Quarter", "Q" & QUARTER ( [Date] ),
"Month number", MONTH ( [Date] ),
"Month-Year", FORMAT ( [Date], "mmm-yy" ),
"Day", FORMAT ( DAY ( [Date] ), "00" ),
"Date format", FORMAT ( [Date], "dd-mm-yyyy" )
)
RETURN
_t
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi,
Please check the below picture and the attached pbix file.
Calendar =
VAR _startdate =
DATE ( 2023, 1, 1 ) // or, mindate from the fact table
VAR _enddate =
DATE ( 2024, 12, 31 ) // or, maxdate from the fact table
VAR _t =
ADDCOLUMNS (
CALENDAR ( _startdate, _enddate ),
"Year", YEAR ( [Date] ),
"Quarter", "Q" & QUARTER ( [Date] ),
"Month number", MONTH ( [Date] ),
"Month-Year", FORMAT ( [Date], "mmm-yy" ),
"Day", FORMAT ( DAY ( [Date] ), "00" ),
"Date format", FORMAT ( [Date], "dd-mm-yyyy" )
)
RETURN
_t
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hello @Anonymous ,
Preparing a Calendar Table Based on Start and Stop Dates
1. Creating the Calendar Table
Calendar = CALENDAR(MIN('Table'[Date]), MAX('Table'[Date]))
This will create a single column named "Date" containing all dates in the specified range.
2. Formatting the "Date" Column
3. Creating Month-Year and Month Columns (Optional)
Month-Year = CONCATENATE(CONCATENATE(FORMAT('Calendar'[Date], "mmmm"), "-"), YEAR('Calendar'[Date]))
Month = FORMAT('Calendar'[Date], "mmmm")
4. Creating Day and Quarter Columns (Optional)
Day = DAY('Calendar'[Date])
Quarter = CONCATENATE("Q", QUARTER('Calendar'[Date]))
I hope this is helpful!
Thanks and Regards,
Sayali
Please mark the question solved when done and consider giving a thumbs up if posts are helpful!!
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
97 | |
69 | |
46 | |
39 | |
33 |
User | Count |
---|---|
163 | |
110 | |
61 | |
51 | |
40 |