Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
The formula below works for calculating the cumulative total by year, displaying null values when past current date. Is there a way I can make the formula stop calculating the cumulative total at the previous month rather than the current month.
I would expect changing the line below to -1 to work but this only removes January from my pivot table:
var __prevMonthEndDate = EOMONTH(__currentMaxDate, -1)
Cumulative E&A Wells (Previous Month):=var __currentMaxDate = MAX('Calendar'[Date])
var __currentMinDate = MIN('Calendar'[Date])
var __today = TODAY()
var __prevMonthEndDate = EOMONTH(__currentMaxDate, 0)
var __cumulativevalue =
CALCULATE(
COUNTROWS('FM Full Export'),
DATESYTD('Calendar'[Date]),
'Calendar'[Date] <= __prevMonthEndDate,
ALLSELECTED('Calendar'[Date])
)
var __shouldDisplay =
--check if the current period is fully contained in the future
NOT(__currentMinDate >= __today)
return
IF(__shouldDisplay, __cumulativevalue)
Many thanks
what is selected in the slicer on the calendar table? or how is it desplayed in the visual?
from what I see the measure should return the same results even if you skip the
'Calendar'[Date] <= __prevMonthEndDate,
because it will always be more constrained by the
DATESYTD('Calendar'[Date]),
so I am quite puzzled how it gives you the 'previous month' - previous in reference to what exactly?
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 23 | |
| 12 | |
| 11 | |
| 9 | |
| 8 |