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! Request now
Hi all,
I would like to have always the current last month displayed in this table like in the picture below. However, I don't want to select the current date every time, I want the measure to pull the previous month automatically.
This is currently my formula. But here I still need the date filter. I only ever need the previous month, all other months do not interest me in this matter.
How is this possible?
Thanks!
Solved! Go to Solution.
[prevMonth] =
var today_ = today()
// get the first day of the previous month
var dayStart = EOMONTH(today_, -2) + 1
// get the last day of the previous month
var dayEnd = EOMONTH(today_, -1)
var result =
CALCULATE(
sum( 'sales'[delivery quantity] ),
all( Kalender[Datum] ),
Kalender[Datum] >= dayStart,
Kalender[Datum] <= dayEnd
)
return
result
[prevMonth] =
var today_ = today()
// get the first day of the previous month
var dayStart = EOMONTH(today_, -2) + 1
// get the last day of the previous month
var dayEnd = EOMONTH(today_, -1)
var result =
CALCULATE(
sum( 'sales'[delivery quantity] ),
all( Kalender[Datum] ),
Kalender[Datum] >= dayStart,
Kalender[Datum] <= dayEnd
)
return
result
@Anonymous , Try like this. It will work for both selected and not selected
Switch Period =
var _max1 = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _max = eomonth(_max,-1)
var _min = eomonth(_max,-2)+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
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 |
|---|---|
| 8 | |
| 6 | |
| 6 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 15 | |
| 8 | |
| 8 | |
| 8 |