Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hello how do I calculate the SUM of the last 3 months excluded current month for selected time period by slicer?
The problem is that if I change the slicer, it does not show the last 3 months of the selected range. It shows only last 3 months from the perspective today. I tried to replace today but nothing I tried worked.
I already have this:
Solved! Go to Solution.
@JFTvK , Try measure like
Rolling 3= CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],eomonth(MAX('Date'[Date]),-1) ,-3,MONTH))
rolling 3 =
var _max =eomonth( if(isfiltered('Date'),MAX( 'Date'[Date]) , today()),-1)
var _min = eomonth(_max,-3) +1
BLANK())
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
but if you want to display a trend then slicer need to be on an independent table
//Date1 is an independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max, -3) +1
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))
Rolling Months Formula: https://youtu.be/GS5O4G81fww
Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc
Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI
It worked perfectly fine, thank you so much! 🙂
@JFTvK , Try measure like
Rolling 3= CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],eomonth(MAX('Date'[Date]),-1) ,-3,MONTH))
rolling 3 =
var _max =eomonth( if(isfiltered('Date'),MAX( 'Date'[Date]) , today()),-1)
var _min = eomonth(_max,-3) +1
BLANK())
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
but if you want to display a trend then slicer need to be on an independent table
//Date1 is an independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max, -3) +1
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))
Rolling Months Formula: https://youtu.be/GS5O4G81fww
Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc
Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
86 | |
84 | |
83 | |
67 | |
49 |
User | Count |
---|---|
131 | |
111 | |
96 | |
71 | |
67 |