Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Hi,
I need to filter a table with the yearmonth column. Initially I am taking the year and then drill down to yearmonth, for now I want to show the data for the last 3months ( sep, oct,nov( complete data for this month's)and the present month data till today (dec till today), similarly for the next upcoming months it should do it automatically. When I drill up then I should be able to see other years and their whole data. Is it possible to write a dax query for this.
Last three months
Last 3 Month =
var _max = eomonth(if(isfiltered('Date'),MAX( 'Date'[Date]) , today()),-1)
var _min = eomonth(_max,-3)+1 ,
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
This month till today
MTD =
var _max = MAXX(allselected('Table'), 'Table'[Sales Date])
var _min = eomonth(_max,-1)+1 ,
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
last 3 month till today
MTD + 3 months =
var _max = MAXX(allselected('Table'), 'Table'[Sales Date])
var _min = eomonth(_max,-4)+1 ,
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
refer: https://medium.com/chandakamit/power-bi-when-i-felt-lazy-and-i-needed-too-many-measures-ed8de20d9f79
User | Count |
---|---|
9 | |
8 | |
5 | |
4 | |
3 |