Forum Discussion
Same Day Last Month
- Anonymous3 years ago
Hi Anonymous ,
Based on your statement, I make a new expression You can check the result as follows:
Measure:
Last month same day = var _pre= EOMONTH(MAX('Table'[DATE]),-1) return DATE(YEAR(_pre),MONTH(_pre),DAY(MAX('Table'[DATE])))Perhaps this will work, and if you have any questions, please provide me a simple sample to make sure we can better solve the problem for you!
An attachment for your reference. Hope it helps.
Best regards,
Community Support Team_ Scott Chang
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
Based on your description, I created the DAX expression, you may check the result below:
New table:
Table 2 =
CALENDAR ( DATE ( 2023, 1, 1 ), TODAY () )
Measure:
Same day =
VAR _now =
MAX ( 'Table 2'[Date] )
RETURN
IF (
MONTH ( _now ) <> 1,
DATE ( YEAR ( _now ), MONTH ( _now ) - 1, DAY ( _now ) ),
DATE ( YEAR ( _now ) - 1, MONTH ( _now ) - 1 + 12, DAY ( _now ) )
)
An attachment for your reference. Hope it helps.
Best regards,
Community Support Team_ Scott Chang
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous3 years agoNot applicable
Thanks for reply.
This will work for disconnected tables but in my model, dim_date table connected to Fact table. In this case, your code is not working
- Anonymous3 years agoNot applicable
Hi Anonymous ,
Based on your statement, I make a new expression You can check the result as follows:
Measure:
Last month same day = var _pre= EOMONTH(MAX('Table'[DATE]),-1) return DATE(YEAR(_pre),MONTH(_pre),DAY(MAX('Table'[DATE])))Perhaps this will work, and if you have any questions, please provide me a simple sample to make sure we can better solve the problem for you!
An attachment for your reference. Hope it helps.
Best regards,
Community Support Team_ Scott Chang
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.