Together with FromType, this defines the starting position of the window.
FromType
Optional
An enumeration that defines how From should be interpreted. Valid values are: ABS, REL.
To
Together with ToType, this defines the ending position of the window.
ToType
Optional
An enumeration that defines how To should be interpreted. Valid values are: ABS, REL.
Relation
Optional
A table expression from which the output rows will be returned.
OrderBy
Optional
Columns that define how each partition is sorted.
Blanks
Optional
An enumeration that defines how BLANK values are ordered. Valid value is DEFAULT for now.
PartitionBy
Optional
Columns that define how Relation is partitioned.
MatchBy
Optional
Columns that define how the current row is identified.
Reset
Optional
Specifies how the calculation restarts. Valid values are: None, LowestParent, HighestParent, or an integer.
Return Values
All rows from the window.
Remarks
Except for columns added by DAX table functions, each column in relation, when matchBy is not present, or each column in matchBy and partitionBy, when matchBy is present, must have a corresponding outer value to help define the current row on which to operate. If from_type and to_type both have value ABS, then the following applies only to the partitionBy columns:
If there is exactly one corresponding outer column, its value is used.
If there is no corresponding outer column:
WINDOW will first determine all columns that have no corresponding outer column.
For every combination of existing values for these columns in WINDOW’s parent context, WINDOW is evaluated, and the corresponding rows is returned.
WINDOW final output is a union of these rows.
If there is more than one corresponding outer column, an error is returned.
If all of relation‘s columns were added by DAX table functions, an error is returned.
If matchBy is present, WINDOW will try to use matchBy and partitionBy columns to identify the row.
If matchBy is not present and the columns specified within orderBy and partitionBy cannot uniquely identify every row in relation, then:
WINDOW will try to find the least number of additional columns required to uniquely identify every row.
If such columns can be found, WINDOW will automatically append these new columns to orderBy, and each partition is sorted using this new set of orderBy columns.
If such columns cannot be found, an error is returned.
An empty table is returned if:
The corresponding outer value of an orderBy or partitionBy column does not exist within relation.
The whole window is outside the partition, or the beginning of the window is after its ending.
If WINDOW is used within a calculated column defined on the same table as relation, and orderBy is omitted, an error is returned.
If the beginning of the window turns out be before the first row, then it’s set to the first row. Similarly, if the end of the window is after the last row of the partition, then it’s set to the last row.
reset can be used in visual calculations only, and cannot be used in combination with orderBy or partitionBy. If reset is present, axis can be specified but relation cannot.
Returns the 3-day average of unit prices for each product. Note the 3-day window consists of three days in which the product has sales, not necessarily three consecutive calendar days.
Returns the cumulative total sales by month, calculated along each year. The values 1 and -2 could be used instead of HIGHESTPARENT, with the same results.
The screenshot below shows the visual matrix and the visual calculation expression: