In DAX, to specify a fixed date boundary such as 2023-12-01 in a query, which function is used?

Prepare for the Fabric Analytics Engineer Associate Test with comprehensive materials. Explore flashcards, multiple choice questions, and detailed explanations. Get ready for your success!

Multiple Choice

In DAX, to specify a fixed date boundary such as 2023-12-01 in a query, which function is used?

Explanation:
When you need a fixed date in a DAX expression, you use the DATE function to construct that date from year, month, and day. DATE(2023, 12, 1) yields the specific date 2023-12-01 that stays constant each time the query runs. This is ideal for setting a static boundary in filters or comparisons. In contrast, TODAY or NOW would provide the current date or current date and time, which would shift over time and thus wouldn’t be a stable boundary. The DATETIME form can include a time component if needed, but for a purely date-only boundary, DATE is the most straightforward choice. Example: CALCULATE(SUM(Sales[Amount]), Sales[Date] <= DATE(2023, 12, 1))

When you need a fixed date in a DAX expression, you use the DATE function to construct that date from year, month, and day. DATE(2023, 12, 1) yields the specific date 2023-12-01 that stays constant each time the query runs. This is ideal for setting a static boundary in filters or comparisons.

In contrast, TODAY or NOW would provide the current date or current date and time, which would shift over time and thus wouldn’t be a stable boundary. The DATETIME form can include a time component if needed, but for a purely date-only boundary, DATE is the most straightforward choice.

Example: CALCULATE(SUM(Sales[Amount]), Sales[Date] <= DATE(2023, 12, 1))

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy