Store a table in a variable: count busy days with VAR and COUNTROWS

Keep a filtered list of days in a DAX variable, then count it with COUNTROWS — the first step into virtual tables.

You will learn to

  • Store a table (not just a number) in a variable
  • Build a list of visible days with VALUES
  • Count the rows of a filtered table with COUNTROWS

How it works

A **virtual table** is a table that exists only while your measure runs. You never see it in the model, but you can filter it, count it and loop over it.

A variable can hold a whole table, not just a number. `VAR BigLines = FILTER(Sales, Sales[Amount] >= 1000)` keeps a list of rows, and the `RETURN` part can then ask questions about that list.

`VALUES('Date'[Date])` is the list of days the current cell can see: about 90 days in a quarter, 365 in a year. When `FILTER` walks that list and you use a measure such as `[Order Lines]` in the condition, the measure is calculated **for each day** (context transition). A day with no sales returns blank, and blank is never 3 or more, so quiet days drop out on their own.

Practice it hands-on with a real data model and a live report that updates as you type.

Big Lines =
VAR BigLines = FILTER(Sales, Sales[Amount] >= 1000)
RETURN COUNTROWS(BigLines)