Forum Discussion
Calculating Remaining Days from last reporting date
- 5 years ago
Hi veerub , just so we are clear Remaining Days calculates the remaining days from today, and the Date Count calculates from the reporting date to the maturity. Added some dax to make a negative number if the report date exceeds maturity. Changed the date to 6/3/2021 so that it exceeds the maturity date in one instance.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
NathanielDateCount = VAR _today = TODAY () //This measure returns the count from last reporting date to maturity, but if the bond has already matured, returns the diff from last reporting date to maturity date VAR _reportDate = [ReportDate] VAR _bondMaturity = MAX ( Maturity[MaturityDate] ) VAR _dateDiff = DATEDIFF ( _reportDate, IF ( _today > _bondMaturity, _today, _bondMaturity ), DAY ) var _reverseDateDiff = DATEDIFF(_reportDate,_bondMaturity,DAY) RETURN If(_bondMaturity>_today, _dateDiff,if(_bondMaturity<_reportDate,_reverseDateDiff)) ======================================================================= RemainingDays = VAR _today = TODAY () //This measure returns 0 if matured else number of remaining dayes VAR _reportDate = [ReportDate] VAR _bondMaturity = MAX ( Maturity[MaturityDate] ) VAR _dateDiff = DATEDIFF ( _today,_bondMaturity, DAY ) var _reverseDateDiff = DATEDIFF(_reportDate,_bondMaturity,DAY) RETURN If(_bondMaturity>_today, _dateDiff,if(_bondMaturity<_reportDate,_reverseDateDiff))
I just built a table with the date in it. It justs needs to be a separate table. In your world, where would you get that date?
So in the picture below except for the -numbers, is DateCount, or Remaining Days, the expected outcome.
The reporting date will change on daily basis and will need to be updated by user. What would be the most appropriate way to implement it? Can this be done via an excel?