Forum Discussion
MeghnaZutshi
3 years agoFrequent Visitor
Calculations on dates
How to get MTD sales for current month and for previous month, same date range? Suppose today is April 15 so i would require sales from
1. 1st to 14th April and
2. 1st to 14th March .
These should be two seperate calculations
Thanks in advance
- Anonymous3 years ago
Hi MeghnaZutshi ,
According to your description, we can create two measures.
MTD Sales April = CALCULATE ( SUM ( Sales[Sales Amount] ), DATESBETWEEN ( 'Date'[Date], DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ), 1 ), TODAY () - 1 ) )MTD Sales March = CALCULATE ( SUM ( Sales[Sales Amount] ), DATESBETWEEN ( 'Date'[Date], DATE ( YEAR ( EOMONTH ( TODAY (), -2 ) ), MONTH ( EOMONTH ( TODAY (), -2 ) ), 1 ), EOMONTH ( TODAY (), -2 ) + DAY ( TODAY () ) - 1 ) )Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- AnonymousNot applicable
Hi MeghnaZutshi ,
According to your description, we can create two measures.
MTD Sales April = CALCULATE ( SUM ( Sales[Sales Amount] ), DATESBETWEEN ( 'Date'[Date], DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ), 1 ), TODAY () - 1 ) )MTD Sales March = CALCULATE ( SUM ( Sales[Sales Amount] ), DATESBETWEEN ( 'Date'[Date], DATE ( YEAR ( EOMONTH ( TODAY (), -2 ) ), MONTH ( EOMONTH ( TODAY (), -2 ) ), 1 ), EOMONTH ( TODAY (), -2 ) + DAY ( TODAY () ) - 1 ) )Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.