Home » DAX » ISONORAFTER DAX Function

ISONORAFTER DAX Function

ISONORAFTER DAX with DESC Order

The ISONORAFTER DAX function is used to return a record from the start position specified in the condition, and returns the result as a Boolean.

Based on the sort order, the first parameter is compared with the second parameter. If the sort order is ascending, the comparison to be done is first parameter greater than the second parameter.

If the sort order is descending, the comparison to be done is second parameter less than the first parameter.

Syntax

ISONORAFTER(<scalar_expression>, <scalar_expression>, sort_order , <scalar_expression>, <scalar_expression>, sort_order…)

Parameters

scalar expression – Any expression that returns a scalar value like a column reference or integer or string value. Typically the first parameter is a column reference and the second parameter is a scalar value.

sort order– (optional) The order in which the column is sorted. Can be ascending (ASC) or descending (DEC). By default the sort order is ascending.



Sample data set for example

ID Product Sales
1 A 100
2 B 200
3 C 50
4 D 40
5 E 100
6 F 100
7 A 50
8 B 100

Let’s Get Started

Create a New column and write below DAX formula

Flg = ISONORAFTER(TempData[Product], "B", ASC)

Here, Product order is ASC, So it will return True for all records from B Product to till last product.

ISONORAFTER DAX

ISONORAFTER DAX

Now change the Product order DESC and see the result- It will return True form B product to till first product which is A.

ISONORAFTER DAX with DESC Order

ISONORAFTER DAX with DESC Order



ISONORAFTER DAX with Measure

Create a measure with below DAX formula-

ISONORAFTER DAX =
CALCULATE (
    SUM ( TempData[Sales] ),
    FILTER ( TempData, ISONORAFTER(  TempData[Product], "B", ASC))
)

Here, Product order is ASC, so it will return records from B to till last product.

ISONORAFTER DAX With Measure

ISONORAFTER DAX With Measure

Hope you enjoyed the post, you can refer Other DAX functions: DAX functions

Leave a Reply