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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Vvelarde
Community Champion
Community Champion

@PowerBIlearner

 

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




Lima - Peru

View solution in original post

9 REPLIES 9
jgubler
Advocate III
Advocate III

first day of current month = DATE(YEAR(today()), month(today()), 1)

This did it for me.
Baskar
Resident Rockstar
Resident Rockstar

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.

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/

 

Imke Feldmann (The BIccountant)

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

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

Vvelarde
Community Champion
Community Champion

@PowerBIlearner

 

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




Lima - Peru

It Works, Thank you very much ! 🙂

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

KHorseman
Community Champion
Community Champion

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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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

I did it but It doesn't work

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.