Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Last day current month

I'm trying to write a measure that will let me know the last day of the current month:

 

Last Day of Month = ENDOFMONTH('Work Date'[Date])
 
But this didn't give me the last day of the current month it gave me the last day of the month as being 12/31/2072
  • TheoC's avatar
    TheoC
    4 years ago

    Hi Anonymous 

     

    That makes a lot of sense.  Try this measure and hopefully it will give you the end of the current month:

     
    Measure = EOMONTH ( TODAY () , 0 )
    (updated thanks to parry2k to ensure no one uses the ridiculousness of my earlier "solution").
     
    This will give 28 Feb 2022.  You can adjust month by changing the 0 at the end accordingly.
     
    Hope this helps 🙂
     
    Theo
     

8 Replies

  • Anonymous in future you should be very clear in your requirement so that it saves everyone's time. Just my 2 cents. Well done TheoC  but you don't have to do all that, you can just simply do this FYI

     

    Measure = EOMONTH ( TODAY ()  , 0 )

     

     

     

    ✨ Follow us on LinkedIn and  to our YouTube channel

     

    Check my latest video on Filters and Sparklines https://youtu.be/wmwcX8HvNxc

     

    I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    ⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

    • TheoC's avatar
      TheoC
      Icon for Community Champion rankCommunity Champion

      parry2k I am in tears... I had forgot to add the 0 and couldn't understand why EOMONTH ( TODAY () ) wasn't working 😂 - cheers mate!

  • Anonymous if you are writing a measure this is what you should use:

     

    Last Day of month = EOMONTH ( MAX ( YourTable[Date] ), 0 )

     

     

     

    ✨ Follow us on LinkedIn and  to our YouTube channel

     

    Check my latest video on Filters and Sparklines https://youtu.be/wmwcX8HvNxc

     

    I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    ⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

  • TheoC's avatar
    TheoC
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 

     

    If the measure that parry2k results in the same output, there may be a manual input error in the source file (i.e. Excel or CSV file) that you are using which has led to someone typing the year as 2072 rather than 2022 or the like.  However, if it's not this, then I am sure parry2k measure will provide you with the solution you are after.

     

    All the best either way!

    Theo

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you TheoC and parry2k , 

       

      but I'm still gettign 2072. Its not an error this is pulling from a live connection and the date ranges is 1904-2072 so if I do Min it is showing January 1, 1904 and Max is showing December 31, 2072.  

      • TheoC's avatar
        TheoC
        Icon for Community Champion rankCommunity Champion

        Hi Anonymous 

         

        That makes a lot of sense.  Try this measure and hopefully it will give you the end of the current month:

         
        Measure = EOMONTH ( TODAY () , 0 )
        (updated thanks to parry2k to ensure no one uses the ridiculousness of my earlier "solution").
         
        This will give 28 Feb 2022.  You can adjust month by changing the 0 at the end accordingly.
         
        Hope this helps 🙂
         
        Theo
         
  • TheoC's avatar
    TheoC
    Icon for Community Champion rankCommunity Champion

    Hi @kari1282 

     

    That makes a lot of sense.  Try this measure and hopefully it will give you the end of the current month:

     
    Measure = EOMONTH ( TODAY() , 0 )
     
    This will give 28 Feb 2022 (at time of writing this response).  You can adjust month by changing the 0 at the end accordingly.
     
    Hope this helps 🙂

     

     
    Theo