Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
MCarmassi
Frequent Visitor

Calendar table can't contain date outside its range

Hello you all. 

 

I am making a calendar table with the calendar function just like

 

DateTable=CALENDAR(DATE(2023,01,01),DATE(2023,12,31))

 

 

Then I want to associate to every date in this table the starting date of the week (with weeks starting on Monday) so I add a calculated column with the following DAX code

 

 

WeekStart = DATEADD(TabellaDate[Date], 1-WEEKDAY(TabellaDate[Date], 2), Day)

 

 

The problem is, this outputs BLANK() for the first rows. Actually, I am pretty certain that I can't in any way write in this table any date that is outside the initial 01/01/2023 - 31/12/2023 range.

 

Is this the correct behaviour? And if it is, what is the advantage and how can I do what I want to do?

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

pls try this

 

WeekStart = [Date]-WEEKDAY([Date],2)+1

EndStart = [Date]-WEEKDAY([Date],2)+7

 

View solution in original post

3 REPLIES 3
Ahmedx
Super User
Super User

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.

Ahmedx
Super User
Super User

pls try this

 

WeekStart = [Date]-WEEKDAY([Date],2)+1

EndStart = [Date]-WEEKDAY([Date],2)+7

 

It does work. So the culprit is the DATEADD function. In fact, I see it is specified in the documentation that


  • The result table includes only dates that exist in the dates column.

 



Thank you very much.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Power BI Header Change

Power BI Header Update

Read about the exciting updates for the Power BI forum.