cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowerBIlearner
Frequent Visitor

DAX first day of current month

I want to do Month to date and year to date calculation without using MTD and YTD functions. I know Today() stands for Today's date. In the same lines can someone please tell me how do I get the first day of current month (example 1/1/2017 currently) and first day of current year? TIA.

 

@Baskar @Seth_C_Bauer @ankitpatira @BhaveshPatel @ImkeF @KHorseman @Greg_Deckler.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Vvelarde Community Champion
Community Champion

Re: DAX first day of current month

@PowerBIlearner

 

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




Lima - Peru

View solution in original post

7 REPLIES 7
Super User I
Super User I

Re: DAX first day of current month

First Day of This Month = DATE(YEAR(TODAY()), MONTH(TODAY()), 1)


Did I answer your question? Please mark it as a solution.

Proud to be a Datanaut!
Highlighted
Vvelarde Community Champion
Community Champion

Re: DAX first day of current month

@PowerBIlearner

 

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




Lima - Peru

View solution in original post

Baskar Resident Rockstar
Resident Rockstar

Re: DAX first day of current month

Cool my dear friend ,

 

try this one.

 

FIRSTDATE(Dates)

 

It will give u the first date from the date.

 

If u choose month it will give u the start of month, if u select year it will give start of year.

 

let me know if any help.

Super User III
Super User III

Re: DAX first day of current month

This is a way to easily calculate MTD and YTD without the need to calculate the first days first:

[SalesYTD] := 
CALCULATE (
    [Sales], 
    FILTER (
        ALL ( 'Date' ), 
        'Date'[Year] = MAX ( 'Date'[Year] )
            && 'Date'[Date] <= MAX ( 'Date'[Date] )
    )
)

Taken from DAXPatterns here: http://www.daxpatterns.com/time-patterns/

 
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark my post as a solution. Thanks!

Imke Feldmann

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

 
bella
New Member

Re: DAX first day of current month

I did it but It doesn't work

Elder22
Frequent Visitor

Re: DAX first day of current month

Thanks, this has given me help on another problem I was having.

Serdia
Frequent Visitor

Re: DAX first day of current month

How can I get the first day of month If I have "Year" as a parameter?

If year 2018 - I need May 1,2018

if Year 2017 - I need May 1, 2017 etc

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors