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,
I'm trying to create a measure which will give me an average of the previous 3 months, but exclude the current month. For example, for May 2021 I want that to be an average of February 2021, March 2021 and April 2021.
Currently using the measure below I have been able to display the 3 month average but for May 2021 it's the Average of March, April and May
3 Month Rolling Average Fall Through =
IF (
ISBLANK ( [Withdrawals]),
BLANK (),
CALCULATE (
AVERAGEX ( VALUES ( 'Date'[Month/Year] ),[Withdrawal %]),
DATESINPERIOD ( 'Date'[Full Date], LASTDATE ( 'Date'[Full Date] ), -3, MONTH )
)
)
This is what the average is on a month to month basis
This is what it looks like on a 3 Month Average basis
Looking at the first Visual, the average for March, April and May is 38%, 47% and 24% which gives us an Average over them 3 months of 36%.
The figure that I want is the average for February, March and April which is 50%, 38% and 47% which gives us an average of 45%. 45% is what should be showing in the May 2021 3 month average
Does anyone know how I can do this?
I'll attach the PBIX file below
https://www.dropbox.com/s/xkoqrr1n7zabshn/Withdrawal%20Help.pbix?dl=0
Cheers,
Mike
Solved! Go to Solution.
@michael_knight , sorry, my mistake. Try like
CALCULATE (
AVERAGEX ( VALUES ( 'Date'[Month/Year] ),[Withdrawal %]),
DATESINPERIOD ( 'Date'[Full Date], eomonth ( max('Date'[Full Date]) ,-1), -3, MONTH )
)
@michael_knight , Try like
3 Month Rolling Average Fall Through =
IF (
ISBLANK ( [Withdrawals]),
BLANK (),
CALCULATE (
AVERAGEX ( VALUES ( 'Date'[Month/Year] ),[Withdrawal %]),
DATESINPERIOD ( 'Date'[Full Date], eomonth ( 'Date'[Full Date] ,-1), -3, MONTH )
)
)
or only
CALCULATE (
AVERAGEX ( VALUES ( 'Date'[Month/Year] ),[Withdrawal %]),
DATESINPERIOD ( 'Date'[Full Date], eomonth ( 'Date'[Full Date] ,-1), -3, MONTH )
)
make sure Date is marked as date table
Hi @amitchandak
I tried both suggestions and got this error
"A single value for column 'Full Date' in table 'Date' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."
I made sure to mark Date as a date table too
@michael_knight , sorry, my mistake. Try like
CALCULATE (
AVERAGEX ( VALUES ( 'Date'[Month/Year] ),[Withdrawal %]),
DATESINPERIOD ( 'Date'[Full Date], eomonth ( max('Date'[Full Date]) ,-1), -3, MONTH )
)
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 |
---|---|
107 | |
96 | |
77 | |
66 | |
53 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |