The ISONORAFTER function returns a Boolean depending on whether or not the conditions indicated for the row being considered are met.
ISONORAFTER(
scalar_expression,
scalar_expression
[, sort_order
[, scalar_expression, scalar_expression, sort_order...]]
)
- scalar_expression: Any expression that returns a scalar or a column. Typically the first argument is a column and the second a scalar value.
- sort_order: Optional argument. Order in which expressions are considered. It can be ascending (ASC, default value) or descending (DESC).
The ISONORAFTER function returns a Boolean.
The arguments that define each condition are included in blocks of three. If only one condition is being specified, the argument indicating the order is optional, but if two or more conditions are being specified, this parameter becomes mandatory for all conditions except the last one.
The function returns True when all conditions are met.
Based on the order specified for each condition, the first argument is compared to the second. In the case that the order is ascending, the function returns True for all the values of the first argument that are greater than or equal to the second one. If descending, the function returns True if the second argument is greater than or equal to the first one.
We start from a data model that includes a sales table ("Sales") with information on the number of units sold ("Units" field) and a table of geographical locations ("Geography") with information on the country in which the sale is made ("Country" field). The countries included are Italy, France, Portugal and Spain (listed in alphabetical order).
We can create a new table filtering the sales table imposing as a condition that the country is Portugal "or higher" (Spain, considered in alphabetical order), and that the sales involve 3 units or less:
Tabla =
FILTER(
Sales,
ISONORAFTER(
RELATED(Geography[Country]), "Portugal", ASC,
Sales[Units], 3, DESC
)
)
However, even though the Microsoft documentation specifies that the function will return True only when all conditions are met, this is not what happens in practice. And we can check this by taking the resulting list of countries to a table-type display, and the minimum and maximum number of units sold per country:
We see that the two conditions imposed are met for Portugal, but not for Spain.