dosubot[bot] commented on issue #40521: URL: https://github.com/apache/superset/issues/40521#issuecomment-4573363963
<!-- Greeting --> Hi @Heldenmar! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team. <!-- Answer --> This is actually the expected behavior in Superset — "Last month" is intentionally a **relative duration** (1 month backward from today), not the previous calendar month. For example, if today is May 15, "Last month" returns April 15 – May 15, not April 1–30. The implementation uses `DATEADD(DATETIME('today'), -1, month)` internally [[1]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/utils/date_parser.py#L303-L307). If you want the **previous calendar month** (April 1–30 in your example), Superset provides a separate option called **"previous calendar month"**, which uses calendar-aligned truncation [[2]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/utils/date_parser.py#L366-L371): ``` DATETRUNC(DATEADD(DATETIME('today'), -1, MONTH), MONTH) : DATETRUNC(DATETIME('today'), MONTH) ``` You can also enter this as a custom time range expression in the time filter's "Advanced" tab if "previous calendar month" isn't visible in your quick options. The naming can be confusing — "Last month" reads like it should mean the previous calendar month, but in Superset's design it means "1 month ago from now." This is consistent across other relative options like "Last week" (7 days back, not the previous Mon–Sun) [[3]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/tests/unit_tests/utils/date_parser_tests.py#L196-L198). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).* --- Docs are dead. Just use [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-tagline&utm_term=apache%2Fsuperset). [](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-feedback&utm_term=apache%2Fsuperset&message_id=4784d68d-eb34-4677-879e-afb8f75bb081) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-ask-repo&utm_term=apache%2Fsuperset) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-share-team&utm_term=apache%2Fsuperset) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
