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
s-roberts
Helper I
Helper I

Dax for next quarterly due date

I have a loan start date of April 15th 2022 and have a quarterly payment. How do I calculate the number of days from today that's it's due each quarter. 
The report will need to show upcoming due dates and number of days (from today) that it's due.

Its not based on a calendar quarter The initial start date per loan can be any date. 

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

The EDATE() function shows the date a few months before or after the initial date specified.  If you are looking for some other solution, then share some data and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

v-xiaotang
Community Support
Community Support

Hi @s-roberts 

You can try this. Let's just take the first quarter as an example, because the principle of other quarters is the same.

create the measure

Measure = 
var _today=TODAY()
var _duration= CALCULATE(MAX('Table'[Duration (quarters)]),'Table'[loan ID]= MIN('loan list'[loan ID]))
var _loanstartDate=CALCULATE(MAX('Table'[loan start date]),'Table'[loan ID]= MIN('loan list'[loan ID]))
var _endDate= EDATE(_loanstartDate,_duration*3)

var _currentQ= DATEDIFF(_loanstartDate,_today,QUARTER)+1
var _currentdays= DATEDIFF(_today,EDATE(_loanstartDate,_currentQ*3),DAY)
var _currentEnd=EDATE(_loanstartDate,_currentQ*3)
return  "Currently in quarter"&_currentQ&UNICHAR(10)&"remaining days = "&_currentdays&UNICHAR(10)&"Current Due date: "&_currentEnd&UNICHAR(10)&"End Date: "&_endDate

result

vxiaotang_2-1652949667673.png

Of course, you can split the statements as a single measure, just choose the way you like.

vxiaotang_1-1652949411474.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @s-roberts 

You can try this. Let's just take the first quarter as an example, because the principle of other quarters is the same.

create the measure

Measure = 
var _today=TODAY()
var _duration= CALCULATE(MAX('Table'[Duration (quarters)]),'Table'[loan ID]= MIN('loan list'[loan ID]))
var _loanstartDate=CALCULATE(MAX('Table'[loan start date]),'Table'[loan ID]= MIN('loan list'[loan ID]))
var _endDate= EDATE(_loanstartDate,_duration*3)

var _currentQ= DATEDIFF(_loanstartDate,_today,QUARTER)+1
var _currentdays= DATEDIFF(_today,EDATE(_loanstartDate,_currentQ*3),DAY)
var _currentEnd=EDATE(_loanstartDate,_currentQ*3)
return  "Currently in quarter"&_currentQ&UNICHAR(10)&"remaining days = "&_currentdays&UNICHAR(10)&"Current Due date: "&_currentEnd&UNICHAR(10)&"End Date: "&_endDate

result

vxiaotang_2-1652949667673.png

Of course, you can split the statements as a single measure, just choose the way you like.

vxiaotang_1-1652949411474.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Ashish_Mathur
Super User
Super User

Hi,

The EDATE() function shows the date a few months before or after the initial date specified.  If you are looking for some other solution, then share some data and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.