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
EmilyM2019
Helper II
Helper II

Wanting to do a date count up to last calendar of the previous month

Hello all,

 

I am building a report to give organisational data to senior stakeholders. What I need in the report is a date count between a due date and the reporting date which is always the last calendar day of the previous month.

 

This is the DAX that I am currently using which is based on a criteria within my final PDR rating column. This works for the reporting date of 31st Jan 21.

 

Count of days since due date = IF('WFP data'[Final PDR rating]="Outstanding",DATEDIFF('WFP data'[PDR due date],"31/01/2021",DAY),BLANK())

 

However, the obvious issue is that I would have to go into the formula and change the reporting date every month.

 

Does anyone know of any way of getting this to automatiocally count the calendar days from the PDR due date and the last calendar day of the previous month?

 

Any help would be appreciated.

 

Regards,

 

Emily.

 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@EmilyM2019 , Try like

Count of days since due date = IF('WFP data'[Final PDR rating]="Outstanding",DATEDIFF('WFP data'[PDR due date],eomonth(today(),-1),DAY),BLANK())

View solution in original post

3 REPLIES 3
mahoneypat
Employee
Employee

You can use EOMONTH(TODAY(), -1) to get the last date of the previous month dynamically.

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


amitchandak
Super User
Super User

@EmilyM2019 , Try like

Count of days since due date = IF('WFP data'[Final PDR rating]="Outstanding",DATEDIFF('WFP data'[PDR due date],eomonth(today(),-1),DAY),BLANK())

Great, thank you.

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.