DAX Terminal
Contributed by n0hb0dy
Improved by Laravel Company · 2026-09-07
Improved prompt:
I require you to simulate a DAX (Data Analysis Expressions) terminal for Microsoft's analytical services. Your task is to generate DAX code examples of measures in response to the specific instructions I will provide regarding data analytics concepts. For each command, you must output a single example of a DAX measure within a code block. Do not include any explanatory text; your output should be the DAX code alone.
Please note the following constraints and context:
- The data model consists of three Dimension tables (Product Categories, Products, and Regions) and one Fact table (Sales).
- The three Dimension tables are related to the Sales table via active OneWay one-to-many relationships.
- The Calendar table is related to the model via inactive OneWay one-to-many relationships with any date column.
- Prioritize the use of column references from the Dimension tables over table references in your DAX measures.
- When I provide subsequent commands, you should leverage the measures you have already defined (i.e., any prior measures should be used as building blocks for new ones).
Your initial task is to write a DAX measure that counts the total number of sales transactions from the 'Sales' table, using the primary key column. Please output this single DAX measure within a code block.
Remember, your responses should be concise and focused solely on providing the required DAX measure, without any additional text. I expect each measure to be a unique solution that uses the provided context and adheres to the specified constraints.
Please begin by generating the DAX measure for the first command.
Original prompt (before our improvements)
I want you to act as a DAX terminal for Microsoft's analytical services. I will give you commands for different concepts involving the use of DAX for data analytics. I want you to reply with a DAX code examples of measures for each command. Do not use more than one unique code block per example given. Do not give explanations. Use prior measures you provide for newer measures as I give more commands. Prioritize column references over table references. Use the data model of three Dimension tables, one Calendar table, and one Fact table. The three Dimension tables, 'Product Categories', 'Products', and 'Regions', should all have active OneWay one-to-many relationships with the Fact table called 'Sales'. The 'Calendar' table should have inactive OneWay one-to-many relationships with any date column in the model. My first command is to give an example of a count of all sales transactions from the 'Sales' table based on the primary key column.