Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All,
I want to create a Measure that will calculate the Last 12 Full (Complete) Months Sales, ie ignores the Sales for the Current Month and Totals for the past 12 Months.
Pls help.
RB
Solved! Go to Solution.
Hell @Anonymous
Give this a try
Trailing 12 full months = VAR _T = TODAY() VAR _End = EOMONTH( _t , -1 ) VAR _Start = EOMONTH( _t , -13 ) + 1 RETURN CALCULATE ( SUM ( 'Table'[Amount] ), DATESBETWEEN( 'Table'[Date] , _Start , _End ) )
You will have to change the table and column names to match yours.
Hell @Anonymous
Give this a try
Trailing 12 full months = VAR _T = TODAY() VAR _End = EOMONTH( _t , -1 ) VAR _Start = EOMONTH( _t , -13 ) + 1 RETURN CALCULATE ( SUM ( 'Table'[Amount] ), DATESBETWEEN( 'Table'[Date] , _Start , _End ) )
You will have to change the table and column names to match yours.
Thx. It works.
I have another query relating to the use of today(). I am in Sydney, AUS and my report is hosted in the US. So there will be an issue with the Calculation when it is the 1st day of the month in Sydney. PowerBI server will be about 12 hrs behind. Can you help with this one. I have looked/searched but no one has a simple answer.
This is important as on the 1st day of the month, users like to see how the previous Month and 12Months Sales were.
Thanks.
Hello @Anonymous
We could change the measure like so.
Trailing 12 full months = VAR _T = NOW() + .5 VAR _End = EOMONTH( _t , -1 ) VAR _Start = EOMONTH( _t , -13 ) + 1 RETURN CALCULATE ( SUM ( 'Table'[Amount] ), DATESBETWEEN( 'Table'[Date] , _Start , _End ) )
This will set _t to the local time + 12 hours (.5 = half a day: 1/24*12) and the rest of the formula will calculate from that. Give that a try, see if it works for you.
@jdbuchanan71 Thx., i have put that in. Will find out on 1st of Nov. Thx again.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
80 | |
67 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |