Forum Discussion
slyfox
9 years agoHelper II
previous month
Hello, I have two linked tables, Fact_Sales and Dim_Callendar Requred a mesure with average calculation for the: Case A: Sum of Sales Qty for the last three months excluding current, divided by n...
Phil_Seamark
9 years agoMicrosoft Employee
Aha, I see what is happening
Want to give this a test? I've highlighted the function to change in red. Let me know how it goes
Sum of Last Three Months =
SUMX(
DATESINPERIOD(
Dim_Calendar[Date],
DATEADD(STARTOFMONTH('Dim_Calendar'[Date]),-3,MONTH),
3,
MONTH),
[Total Amount]
)mrslyfox
9 years agoHelper II
- Phil_Seamark9 years agoMicrosoft Employee
Hi mrslyfox
I think it might be a case of just tweaking the date ranges. eg. the -3 to -2 as I have highlighed in red
Sum of Last Three Months inc current = SUMX( DATESINPERIOD( Dim_Calendar[Date], DATEADD(STARTOFMONTH('Dim_Calendar'[Date]),-2,MONTH), 3, MONTH), [Total Amount] )- mrslyfox9 years agoHelper II
Hello Phil_Seamark
yes, your measure is working as expected,
How to calculate number of callendar days from currently selected 25-Apr till 1st of Feb ?