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
asdf1608
Helper V
Helper V

DateTrunc in power BI

I am converting the tableau functions to Power BI.

I am having doubts in this

dateadd('day',-1,datetrunc('month',dateadd('month',1,[Calendar day])))

How do I convert this to power DAX

For Example: if the  Calender day is 12/4/2022, after dateadd('month',1,{Calender day]) the month gets added by 1. So the answer is "12/5/2022" then  datetrunced by month "1/5/2022". For dateadd the date is substracted by -1. So the final answer is 30/4/2022.

if date = 3/6/2019 answer  after dateadd= 30/6/2019

How do I achieve this in power BI?

1 ACCEPTED SOLUTION
Mahesh0016
Super User
Super User

@asdf1608  in power bi End of Month Dax function 

End Date = ENDOFMONTH('Date'[Date])

Mahesh0016_0-1683622674955.png

 

View solution in original post

2 REPLIES 2
Mahesh0016
Super User
Super User

@asdf1608  in power bi End of Month Dax function 

End Date = ENDOFMONTH('Date'[Date])

Mahesh0016_0-1683622674955.png

 

johnt75
Super User
Super User

For this use case you want EOMONTH([Calendar day],0).

As a more general example you can build dates like

DATE( YEAR([Calendar date]), MONTH([Calendar date]) + 1, DAY([Calendar date]))

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