0
votes

I have two dates

StartDate : 2020-11-02
EndDate : 2020-11-28

How do i create a DAX function that would count my current date against my start date until it reaches the end date.

For example, today is the 14th so if i had to count the 2nd to the 14th i should get a count of 13 days, so my output would be 13.and when I reach the current date of 28th then my day count will be 27 and it ends there.

How do i achieve this in a power bi measure?

1

1 Answers

0
votes

check this measure

mx = 
var start_date = date( 2020, 11, 2) 
var end_date = date(2020,11,28)
var current_date = TODAY()
var future_date = date(2020,12,3)
var end_date_mod = min( current_date, end_date)
return
DATEDIFF( start_date, end_date_mod, day) +1

the future_date variable is for testing purposes, just replace the end_date with future_date in end_date_mod variable