DAX – First Date in Current Year- Not Based on Column

  • DAX – First Date in Current Year- Not Based on Column

    Posted by DSC Communities on November 5, 2019 at 10:38 am
    • Christian ArltX

      Member

      November 5, 2019 at 10:38 AM

      What is the easiest formula to return the first date of the current year – not looking at a column, but rather the current date?

      I don’t know why = Startofyear(Today()) doesn’t work… seems like it would be an easy solution

      ——————————
      Beau Arlt
      Business Analyst
      Holland MI
      989-400-7812
      ——————————

    • Vishesh Jain

      Member

      November 6, 2019 at 2:42 AM

      Hi ,

      Please can you try the following measure.

      Start = DATE(YEAR(TODAY()),1,1)

      This is assuming that your start of the year is always January. You can always change the month if the beginning of the year is different and then subtract 1 from the year.

      Please let me know if I am missing something here.

      Thank you,

      ?

      ——————————
      Vishesh Jain
      Owner
      VR Construction
      ——————————
      ——————————————-

    • Robert Williams

      Member

      November 6, 2019 at 3:49 AM

      StartOfYear() function is really misleading. It requires a table column as the input (which is why the Today() function doesn’twork), and returns a table (single column, single row) as a result, for beneficial reasons.

      The thing is, even if you quickly create a new date table with Calendar(“2017-05-23”, “2019-12-31”) for example and run StartOfYear() against this, all it does is bring back the earliest date (2017-05-23), not 2017-01-01 as you might expect.

      has given you a great answer if you are after a single result. But you should pretty much always have a date table in your PBIX project, and it might be that you want to work out the start of year based on a user selection/filter, so suddenly you need to replace Today() with a calendar column from your date table.
      ?

      ——————————
      Robert Williams
      BI Developer
      Hemel Hempstead
      ——————————
      ——————————————-

    DSC Communities replied 5 years, 10 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘DAX – First Date in Current Year- Not Based on Column’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!