Forum Discussion

bonjourposte's avatar
bonjourposte
Helper V
2 years ago
Solved

Which DAX function do I use for this count?

I'm counting every time a status changed in the past MONTH.  Our periods run from the last day of the month, to the previous last day of the month.  So our Accounting date column has August 31, 2024; July 31, 2024; June 30, 2024; May 31, 2024; April 30, 2024, etc.  If a transaction happens on August 17, for example, it gets logged for August 31.  

 

There is no actual "transaction" that tells us if a maturity date changes, we just have to notice that in the previous month, it was one date, and in the current month, it's another date.  

 

I've come up with a table that shows us previous maturity dates: 

 

...using this DAX: 

PreviousMatDateCC =
VAR CurrentMatDate = (LOANHIST[MAT_DATE])

RETURN
CALCULATE(MAX(LOANHIST[MAT_DATE]),FILTER(ALLEXCEPT(LOANHIST,LOANHIST[LOAN]),LOANHIST[MAT_DATE]< CurrentMatDate))
 
But I want to count the instances of maturity date changes per month.  How do I do that?