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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
mclawler
Helper II
Helper II

Add Column Last Completed Month YTD

Hi everybody, looking to add a column which either gives me a 1,0 whether the statement is true or not.  Below is a very rough draft of the requested DAX, but I think it'll relay what I'm trying to accomplish.  Using this for a filter ultimately. 

 

If(month([Date]) < month(today()) && year([Date]) = year(today()), 1, 0)

 

Thank you so much for your time. 

2 ACCEPTED SOLUTIONS
VahidDM
Super User
Super User

Hi @mclawler 

 

What is the issue with your fornula? Try this

Column = 
Var _M = month(today())
Var _Y = year(today())

Return
IF(month([Date])<_M&&year([Date])=_Y,1,0)

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

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 




View solution in original post

Manoj_Nair
Solution Supplier
Solution Supplier

@mclawler- Check this out.

LastCompletedMonthYTD = 
IF (
    YEAR ( YourTable[Date] ) = YEAR ( TODAY () )
        && MONTH ( YourTable[Date] ) = MONTH ( EOMONTH ( TODAY (), -1 ) ),
    1,
    0
)

If this post helps to find solution would be happy if you could mark my post as a solution and give it a thumbs up

Best regards

Manoj Nair
Linkedin - https://www.linkedin.com/in/manoj-nair-%E2%98%81-344666104/

 

 

View solution in original post

6 REPLIES 6
Manoj_Nair
Solution Supplier
Solution Supplier

@mclawler- Check this out.

LastCompletedMonthYTD = 
IF (
    YEAR ( YourTable[Date] ) = YEAR ( TODAY () )
        && MONTH ( YourTable[Date] ) = MONTH ( EOMONTH ( TODAY (), -1 ) ),
    1,
    0
)

If this post helps to find solution would be happy if you could mark my post as a solution and give it a thumbs up

Best regards

Manoj Nair
Linkedin - https://www.linkedin.com/in/manoj-nair-%E2%98%81-344666104/

 

 

Thank you, your DAX worked as well!!

@mclawler-Hi, If the responses provided accurately address the question you posed, it's feasible to select both of them as accepted answers in a Power BI Community post. Choice is yours. 😉

VahidDM
Super User
Super User

Hi @mclawler 

 

What is the issue with your fornula? Try this

Column = 
Var _M = month(today())
Var _Y = year(today())

Return
IF(month([Date])<_M&&year([Date])=_Y,1,0)

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

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 




Not sure why mine wasn't working but your DAX worked perfectly.  Thanks!! 

Glad it worked 🙂

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.