Reply
Regular Visitor
Posts: 16
Registered: ‎11-29-2016
Accepted Solution

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.

 

 


Accepted Solutions
Super User
Posts: 1,559
Registered: ‎05-10-2016

Re: DAX first day of current month

[ Edited ]

@PowerBIlearner

 

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

Lima - Peru
Power BI

View solution in original post


All Replies
Super User
Posts: 1,172
Registered: ‎12-29-2015

Re: DAX first day of current month

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

Super User
Posts: 1,559
Registered: ‎05-10-2016

Re: DAX first day of current month

[ Edited ]

@PowerBIlearner

 

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

Lima - Peru
Power BI
Super Contributor
Posts: 678
Registered: ‎06-03-2016

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
Posts: 1,274
Registered: ‎09-06-2015

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/

 
Frequent Visitor
Posts: 2
Registered: ‎01-31-2017

Re: DAX first day of current month

I did it but It doesn't work

Frequent Visitor
Posts: 7
Registered: ‎05-15-2017

Re: DAX first day of current month

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

Highlighted
Frequent Visitor
Posts: 2
Registered: ‎09-19-2017

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