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
Anonymous
Not applicable

DAX for getting Date of the Previous year previous month last date

Dear Team,

 

I need to get the last date of the previous year previous month as of today.

 

EX: Today is 6/21/2020 i need to get 5/31/2019 using dax.

i need to include this on a Sumarize DAX query. 

for example : Measure 2:=DATE(YEAR(TODAY())-1, MONTH(TODAY())-1,31) but here i dont want to put 31 it should take dynamically.

 

I am trying to find the count between two dates. 

Dates are : the date should be less that start of the month of this month ie < 6/1/2020 and greater than > 05/31/2019

 

Basically a ralative date filter : in the last 12 calender month

1 ACCEPTED SOLUTION
sturlaws
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

not quite sure what your intentions are, but you can find that date by using this:

 

DATE(year(TODAY()),MONTH(TODAY())-12,1)-1

 

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too. 

View solution in original post

1 REPLY 1
sturlaws
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

not quite sure what your intentions are, but you can find that date by using this:

 

DATE(year(TODAY()),MONTH(TODAY())-12,1)-1

 

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too. 

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.