Forum Discussion
joaquinel
3 years agoHelper I
Calculating Previous Month
Hi,
I have a simple formula but cannot obtain the same info for the previous month. Could you please help me? Thank you.
calculate(DISTINCTCOUNT(Pagos[IdPersonaOrigen]), Pagos[FechaInicioValidez] <= MAX('1CalFInicio'[Date]) )
1 Reply
- Greg_DecklerCommunity Champion
joaquinel So normally a "previous month" measure looks something along the lines of:
PM Measure = VAR __CurrentDate = MAX('1CalFlnicio'[Date]) VAR __PMEnd = EOMONTH(__CurrentDate, -1) VAR __PMBegin = DATE(YEAR(__PMEnd), MONTH(__PMEnd), 1) VAR __Table = FILTER(ALL('Pagos'), [FechanlnicioValidez] >= __PMBegin && [FechanlnichioValidez\ <= __PMEnd) VAR __Result = COUNTROWS(DISTINCT(SELECTCOLUMNS('Pagos', "__Id", [IdPersonaOrigen]))) RETURN __Result