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 need to get the YearMonths for the last 12 months and I used the following query but unfortunately it shows all year months:
Evaluate
SUMMARIZECOLUMNS(
'Date'[Year Month],
FILTER(
ALL('Date'[Date]),
'Date'[Date] <= MAX('Date'[Date]) && 'Date'[Date] >= DATEADD('Date'[Date],-12,MONTH)
),
"Val",[Value]
)
ORDER BY [Year Month] DESC
Note that I added Val just to get the Max Date with Value and not get the Max Date which is 2050/12. The Max Date with data is 2021/01. Using the above code would yield to a table with all YearMonths on and before 2021/01. I need only the last 12 months before 2021/01. Thanks in advanced.
Solved! Go to Solution.
@Anonymous , Try this.
SUMMARIZECOLUMNS(
'Date'[Year Month],
FILTER(
ALL('Date'[Date]),'Date'[Date] <= MAX('Date'[Date]) && 'Date'[Date] >= date(year(today()), month(today())-12,day(today()))
),
"Val",[Value]
)
ORDER BY [Year Month] DESC
@Anonymous , PLease try a measure like this with date table
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],max('Date'[Date]),-12,MONTH))
Unfortunately, I need a FILTER within the SUMMARIZECOLUMN to filter the Date or Year Month up to the last 12 months only. I tried using the measure you provided and put it below as a measure but it still displays data from 2017 up to 2021/12 instead of only 2020/01 to 2021/01.
@Anonymous , try like
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],today(),-12,MONTH))
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],eomonth(today(),0),-13,MONTH))
this should work with summarize columns
Sorry but that didnt seem to work as well 😞 I need the FILTER on my SUMMARIZECOLUMNS. Tried using the CALCULATE measure on my Val but it still displays beyond the 12 months.
@Anonymous , Try this.
SUMMARIZECOLUMNS(
'Date'[Year Month],
FILTER(
ALL('Date'[Date]),'Date'[Date] <= MAX('Date'[Date]) && 'Date'[Date] >= date(year(today()), month(today())-12,day(today()))
),
"Val",[Value]
)
ORDER BY [Year Month] DESC
User | Count |
---|---|
116 | |
73 | |
60 | |
48 | |
48 |
User | Count |
---|---|
171 | |
122 | |
60 | |
59 | |
56 |