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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
skdas
New Member

startofmonth & FirstDate function Issue

Hi All,
I was trying to get the first date from a date field or you can say a measure is having a date from which I was trying to get the first date . E.g. the measure is consisting 03-23-2017 , then I want to get 03-01-2017. For which I tried two functions we have in DAX i.e. StartOfMonth & FirstDate. But none of these functions gave me the required result. Then I tried
EOMONTH(Measure,-1)+1. And it gave me the correct answer.
I just wanted to know whether the two functions are working fine for others and I have done something wrong or, these functions are not working at all.


Thanks & Regards,
SKD

1 ACCEPTED SOLUTION

@skdas

 

Just to put it briefly

 

StartofMonth, EndofMonth, FirstDate  return the first date/last date in the "Date Column" which they take as argument.

 

Not the first date/last date of the month


Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
Chiniminiz
Frequent Visitor

Hi, 

 

I always use the startofmonth with a calculatetable function from my date table using 

startofmonth today =
STARTOFMONTH (
CALCULATETABLE (
VALUES ( 'Date'[Date] ),
MONTH ( 'Date'[Date] ) = MONTH ( TODAY () )
)
)

 

It's easy to use and could also be build with DATEADD() 🙂 

 

Have fun!

Eric_Zhang
Employee
Employee

@skdas

STARTOFMONTH

EOMONTH

FIRSTDATE

You can reference the online documentation. They have different actually funtionality.

 

measureFirstDate = CALCULATE(SUM(Table1[value]),FIRSTDATE(Table1[date]))

measureLastDate = CALCULATE(SUM(Table1[value]),LASTDATE(Table1[date]))

startofmo = STARTOFMONTH(Table1[date])

Capture.PNG

 

 

 

 

 

To get the 1st day of a given date, eg in your case, you can apply EOMONTH or 

Measure  = DATE(YEAR([yourMeasure]),MONTH([yourMeasure]),1)

 

 

 

 

 

 

@skdas

 

Just to put it briefly

 

StartofMonth, EndofMonth, FirstDate  return the first date/last date in the "Date Column" which they take as argument.

 

Not the first date/last date of the month


Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors