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

Don'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.

Reply
Anonymous
Not applicable

Current Month starting from the 16th

Hello 🙂

 

I am currently trying to create a column for the current month. I have created a DimDate Table where i want the column to be. I have used the following code to make a yes/no indication according to, if the month is the current month. I have used the following code:

 

IsToday = 
var Currentrowdate = FORMAT(DimDate[Date]; "mm/yyyy")
var istoday = FORMAT(NOW(); "mm/yyyy")
return
IF(istoday = Currentrowdate; "Yes"; "No")

 

I would like the current month to start from the 16th-15th in the next month. So for example from the 16th of July to the 15th of August. It should be possible to auto update the current month, so that code have to be dynamic.

 

Thank you in advance 🙂

3 ACCEPTED SOLUTIONS
Anonymous
Not applicable

@Anonymous 

I found a way to make it work! I just changed your code a bit. Thank you so much! the code is:

 

FNyear = 
Var First = FORMAT(IF(DimDate[DayofMonth]>=16;DATE(DimDate[år];DimDate[Monthof Year]+1;16);IF(DimDate[DayofMonth]<=15;DATE(DimDate[år];DimDate[Monthof Year];16)));"MM/YYYY")
var second = FORMAT(NOW();"MM/YYYY")

return 
IF(First = second;"yes";"No")

View solution in original post

Anonymous
Not applicable

hi @Anonymous ,

 

see this one,

 

Column = 
 
Var First = FORMAT(IF('Table'[Day]>=16, DATE('Table'[Year],'Table'[Month]+1,16),IF('Table'[Day]<=15,DATE('Table'[Year],'Table'[Month],16))),"MMyyyy")
var second = FORMAT(NOW(),"MMYYYY")

return
IF(First = second,"yes","No")
 
 
regards,
naveen

View solution in original post

Anonymous
Not applicable

Hi @Anonymous 

 

I found a solution! 😄 

the code is :

 

Lastmonth = 
Var First = FORMAT(IF(DimDate[DayofMonth]>=16;DATE(DimDate[år];DimDate[Monthof Year]+2;16);IF(DimDate[DayofMonth]<=15;DATE(DimDate[år];DimDate[Monthof Year]+1;16)));"MM/YYYY")
var second = FORMAT(NOW();"MM/YYYY")

return 
IF(First = second;"yes";"No")

Thank you so much for your help ! 😄

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

@Anonymous 

I found a way to make it work! I just changed your code a bit. Thank you so much! the code is:

 

FNyear = 
Var First = FORMAT(IF(DimDate[DayofMonth]>=16;DATE(DimDate[år];DimDate[Monthof Year]+1;16);IF(DimDate[DayofMonth]<=15;DATE(DimDate[år];DimDate[Monthof Year];16)));"MM/YYYY")
var second = FORMAT(NOW();"MM/YYYY")

return 
IF(First = second;"yes";"No")
Anonymous
Not applicable

hi @Anonymous ,

 

Try this formula,

 

FNyear =
Var First = FORMAT(IF('Table'[Day]>=16, DATE('Table'[Year],'Table'[Month],16),IF('Table'[Day]<=15,DATE('Table'[Year],'Table'[Month]-1,16))),"MMyyyy")
var second = FORMAT(NOW(),"MMYYYY")

return
IF(First = second,"yes","No")
 
Capture.JPG
 
Anonymous
Not applicable

hi @Anonymous 

 

It almost works! 😄

 

I want the current month to start from the 16th of last month. So from the 16th of july. The code you have provided gave me the current month from the 16th of august. I have tried to change the code but i can not get it to work so that the start of the month is for the 16th of last month. 

Anonymous
Not applicable

hi @Anonymous ,

 

see this one,

 

Column = 
 
Var First = FORMAT(IF('Table'[Day]>=16, DATE('Table'[Year],'Table'[Month]+1,16),IF('Table'[Day]<=15,DATE('Table'[Year],'Table'[Month],16))),"MMyyyy")
var second = FORMAT(NOW(),"MMYYYY")

return
IF(First = second,"yes","No")
 
 
regards,
naveen
Anonymous
Not applicable

Hi @Anonymous 

 

I found a solution! 😄 

the code is :

 

Lastmonth = 
Var First = FORMAT(IF(DimDate[DayofMonth]>=16;DATE(DimDate[år];DimDate[Monthof Year]+2;16);IF(DimDate[DayofMonth]<=15;DATE(DimDate[år];DimDate[Monthof Year]+1;16)));"MM/YYYY")
var second = FORMAT(NOW();"MM/YYYY")

return 
IF(First = second;"yes";"No")

Thank you so much for your help ! 😄

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.