Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I have below data, I would like to create a measure for rolling 36 month total, based on the selected year.
for example if the selected year is 2024, the minimum month for that year is 01/01/2024, the rolling 36 month shoud sum up from 01/01/2024 until 31/12/2025.
I don't have a date table.
@sabd80 , if you provide some details about what's not working, we might help you further.
HI @AMeyersen ,
In the screenshot below, the column labeled 'Your measure' contains the DAX formula you supplied, which is based on year-end data. However, I require a rolling 36-month calculation instead. For instance, if the first date is 1/05/2022, I need the total to include data up to and including 1/04/2025, spanning a rolling 36-month period.
Additionally, I have a year slicer, and I want the figures to remain consistent when I select a specific year.
Hi @sabd80 , thank you for the clarification.
Does this work for you?
yourmeasure =
-- gets the first of the minimum selected month in the current filter context
VAR _startDate =
EOMONTH ( CALCULATE ( MIN ( 'Table'[Date] ) ), -1 ) + 1
VAR _endDate =
EDATE ( _startDate, 36 ) - 1
-- if you want to include the first of month at the end of the period just remove "-1" at the end
RETURN
CALCULATE (
SUM ( 'Table'[Total] ),
'Table'[Date] >= _startDate
&& 'Table'[Date] <= _endDate
-- if the year slicer filters a separate column, you need to add:
-- ,REMOVEFILTERS ( 'Table'[Year] )
)
This is still showing the figures for the filtered Year. it looks like the REMOVEFLITERS is not working
Hi @sabd80 ,
sorry to hear the suggested solution does not work (yet).
I am pretty sure you'll get a working formula if you get the REMOVEFILTERS part right.
If you are not sure how to do it, you can use ALLEXCEPT() instead of REMOVEFILTERS(). Include all columns in ALLEXCEPT() which need to remain filtered (in general columns you use to group your results
To help you further, I'd need some more information
I'd try something like this:
yourmeasure =
VAR _startYear =
CALCULATE ( YEAR ( MIN ( 'Table'[Date] ) ) )
VAR _end_year = _startYear + 2
VAR _startDate =
DATE ( _startYear, 1, 1 )
VAR _endDate =
DATE ( _end_year, 12, 31 )
RETURN
CALCULATE (
SUM ( 'Table'[Total] ),
'Table'[Date] >= _startDate
&& 'Table'[Date] <= _endDate
)
User | Count |
---|---|
114 | |
74 | |
57 | |
44 | |
39 |
User | Count |
---|---|
176 | |
125 | |
61 | |
60 | |
58 |