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.
I want to get the last 6 months sales ending on the last day of last month from the current date. Following code is what I use. Is there any better suggestion to improve this?
6M pri sales value =
CALCULATE (
SUM ( FactPrimarySales[NetValue] ),
DATESINPERIOD (
DimDate[Date],
CALCULATE (
LASTDATE ( DimDate[Date] ),
DimDate[MonthNo]
= MONTH ( TODAY () ) - 1,
DimDate[Year] = YEAR ( TODAY () )
),
-6,
MONTH
)
)
Solved! Go to Solution.
@Anonymous , Try a measure like this with help from date table
Rolling 6 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],eomonth(MAX('Date'[Date ]),-1),-6,MONTH))
Hi,
If today is December 25, 2020, then i assume that "last day of last month from the current date" should mean 6 months ended November 30, 2020. If my assumption is correct, then try this measure:
=calculate(sum(Sales[Sales Amount]),datesbetween(calendar[date],EDATE(EOMONTH(today(),-1)+1,-6),EOMONTH(today(),-1)))
Hope this helps.
Hi,
If today is December 25, 2020, then i assume that "last day of last month from the current date" should mean 6 months ended November 30, 2020. If my assumption is correct, then try this measure:
=calculate(sum(Sales[Sales Amount]),datesbetween(calendar[date],EDATE(EOMONTH(today(),-1)+1,-6),EOMONTH(today(),-1)))
Hope this helps.
@Anonymous , Try a measure like this with help from date table
Rolling 6 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],eomonth(MAX('Date'[Date ]),-1),-6,MONTH))
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
96 | |
69 | |
45 | |
39 | |
30 |
User | Count |
---|---|
155 | |
96 | |
60 | |
42 | |
41 |