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
gmasta1129
Helper III
Helper III

End of Month If statement formula

Hello,

 

I have a column (titled "PE Date") which consists of dates (ex: 1/2/2022, 1/20/2022 1/31/2022 etc).  

 

I am trying to create an if statement where if the date is the last day of the month (ex: 12/31/, 1/31, 2/28, 3/31, 4/30 etc.) then pull in the word "Yes" and if not then "No".  

 

 

2 ACCEPTED SOLUTIONS
gmasta1129
Helper III
Helper III

Hello, 

 

thanks for the response but what i need is for the formula to say yes its the last day of the month or no it is not the last day of the month.  Your formula above finds each day in the month and pulls in the last day of the month.  

what i did was changed the format of the pe date column by using the VALUE function. This turned 11/30/21 to 44530.    then used a switch statement where if equal to 44530 then "yes", if not then "no". 

View solution in original post

v-yangliu-msft
Community Support
Community Support

Hi  @gmasta1129 ,

Here are the steps you can follow:

1. Create calculated column.

Column =
IF('Table'[PE Date]=EOMONTH('Table'[PE Date],0),"Yes","No")

2. Result:

vyangliumsft_0-1660887948761.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

4 REPLIES 4
v-yangliu-msft
Community Support
Community Support

Hi  @gmasta1129 ,

Here are the steps you can follow:

1. Create calculated column.

Column =
IF('Table'[PE Date]=EOMONTH('Table'[PE Date],0),"Yes","No")

2. Result:

vyangliumsft_0-1660887948761.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

gmasta1129
Helper III
Helper III

Hello, 

 

thanks for the response but what i need is for the formula to say yes its the last day of the month or no it is not the last day of the month.  Your formula above finds each day in the month and pulls in the last day of the month.  

what i did was changed the format of the pe date column by using the VALUE function. This turned 11/30/21 to 44530.    then used a switch statement where if equal to 44530 then "yes", if not then "no". 

MahyarTF
Memorable Member
Memorable Member

Hi,

 

Use below Dax code for creating the column and use it in visuals :

MahyarTF_0-1660712129162.png

Mahyartf
amitchandak
Super User
Super User

@gmasta1129 , you can use closingbalancemonth

https://youtu.be/yPQ9UV37LOU

 

or with a month year column

 

calculate(lastnonblankvalue('Table'[Month Year], Sum(Table[Value]) )

 

calculate(lastnonblankvalue('Table'[Month Year], Sum(Table[Value]) , allexcept(Table, Table[Month Year]) )

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.