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
Avantha
Frequent Visitor

Next 3 Month 1st day Calendar

Hi,

could you please help me on this ?

i wanted to create a 1st day calendar for a next 3 month. I only need the first day of the month. means my table should only have 3 rows.

ex -

1/9/2019

1/10/2019

1/11/2019

 

Tks

Avantha

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

Perhpas try something like this in DAX:

 

Table = 
VAR __today = TODAY()
VAR __month = MONTH(__today)
VAR __year = YEAR(__today)
VAR __month1 = IF(__month = 12,1,__month+1)
VAR __year1 = IF(__month = 12,__year+1,__year)
VAR __date1 = DATE(__year1,__month1,1)
VAR __month2 = SWITCH(__month,11,1,12,2,__month+2)
VAR __year2 = IF(__month >= 11,__year+1,__year)
VAR __date2 = DATE(__year2,__month2,1)
VAR __month3 = SWITCH(__month,10,1,11,2,12,3,__month+3)
VAR __year3 = IF(__month >= 10,__year+1,__year)
VAR __date3 = DATE(__year3,__month3,1)
RETURN { __date1, __date2, __date3 }

If you want M code, @ImkeF  can probably help.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

Perhpas try something like this in DAX:

 

Table = 
VAR __today = TODAY()
VAR __month = MONTH(__today)
VAR __year = YEAR(__today)
VAR __month1 = IF(__month = 12,1,__month+1)
VAR __year1 = IF(__month = 12,__year+1,__year)
VAR __date1 = DATE(__year1,__month1,1)
VAR __month2 = SWITCH(__month,11,1,12,2,__month+2)
VAR __year2 = IF(__month >= 11,__year+1,__year)
VAR __date2 = DATE(__year2,__month2,1)
VAR __month3 = SWITCH(__month,10,1,11,2,12,3,__month+3)
VAR __year3 = IF(__month >= 10,__year+1,__year)
VAR __date3 = DATE(__year3,__month3,1)
RETURN { __date1, __date2, __date3 }

If you want M code, @ImkeF  can probably help.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

It works, thanks a million Smiley Happy

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.