Forum Discussion
Month to date
I want to compare the Month to date of current month with the month to date of last month and the month to date of last 3 months. i had used a formula like
MTD_current month = var MTDs = min(DimDate[FirstDayOfMonth])
1 Reply
- AnonymousNot applicable
Hi @sathish_kumar,
Please refer to the following measures to modify your measures and see if the result achieve your expectation, if not, kindly share your sample data and excepted result to me if you don't have any Confidential Information.
MTD_current month =
CALCULATE (
SUM ( 'FactSales'[TotalAmount] ),
FILTER (
ALLSELECTED ( 'FactSales' ),
FORMAT ( 'FactSales'[Invoice Date], "YYYYMM" )
= FORMAT ( MAX ( 'FactSales'[Invoice Date] ), "YYYYMM" )
)
)
MTD_Last month =
CALCULATE (
SUM ( 'FactSales'[TotalAmount] ),
FILTER (
ALLSELECTED ( 'FactSales' ),
FORMAT ( 'FactSales'[Invoice Date], "YYYYMM" )
= FORMAT ( EDATE ( MAX ( 'FactSales'[Invoice Date] ), -1 ), "YYYYMM" )
)
)
MTD_Last 3 months =
CALCULATE (
SUM ( 'FactSales'[TotalAmount] ),
FILTER (
ALLSELECTED ( 'FactSales' ),
FORMAT ( 'FactSales'[Invoice Date], "YYYYMM" )
= FORMAT ( EDATE ( MAX ( 'FactSales'[Invoice Date] ), -3 ), "YYYYMM" )
)
)
Result would be shown as below:
BTW, Pbix as attached, hopefully works for you.
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.