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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cheresier
Frequent Visitor

Filtering a CALENDAR table to only include first of the month dates

Consider a table defined with the following DAX:

FirstOfTheMonth = FILTER(CALENDAR(DATE(2000, 1, 1), DATE(2030, 12, 31)), DAY([Date] = 1))
 
Effectively, I am trying to have a table that contains all first-of-the-month dates in a given range. However, it seems that the filtering by DAY([Date])=1 is having no effect:
 

2020-09-30 14_21_26-Heatmap_v1.0_1 - Power BI Desktop.png

 

Interestingly, filtering by MONTH works. So, defining the table as FILTER(CALENDAR(DATE(2000, 1, 1), DATE(2030, 12, 31)), MONTH([Date] = 3)) would result in a table that only contains March dates in all the years between 2000 and 2030 (as expected).

 

What is it about filtering by DAY([Date])=1 that is not working?

 

Thanks!

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@cheresier 

You added the last bracket inside DAY

Try this

FirstOfTheMonth = FILTER(CALENDAR(DATE(2000, 1, 1), DATE(2001, 12, 31)), DAY([Date]) = 1)

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

3 REPLIES 3
Fowmy
Super User
Super User

@cheresier 

You added the last bracket inside DAY

Try this

FirstOfTheMonth = FILTER(CALENDAR(DATE(2000, 1, 1), DATE(2001, 12, 31)), DAY([Date]) = 1)

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Well, that was embarassing. Thank you. 

 

Now I wish there was a way to delete this post since it clearly adds no value to the community and serves no other purpose than as a record of my stupidity 🙂

MEEnergy
Frequent Visitor

You can use the Startofmonth function to get the first date of each month. Treat

FirstOfMonth ? STARTOFMONTH(DateTable[Date].[ Date])

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.