ISAFTER

How to Use the Power BI DAX function ISAFTER

What is the ISAFTER Function?

ISAFTER is a logical function in Power BI that returns a TRUE or FALSE value based on whether a specified date or time occurs after a given date or time. The syntax for the ISAFTER function is as follows:


ISAFTER (date1, date2)


Where:

- `date1` is a date or time value that you want to compare to `date2`

- `date2` is a date or time value that you want to compare `date1` to

If `date1` is after `date2`, the function will return TRUE; otherwise, it will return FALSE.

Using the ISAFTER Function in Power BI

To use the ISAFTER function in Power BI, you must first ensure that you have created a valid date or time column in your data model. Once you have done this, follow these steps:

1. Open Power BI and load your data model.

2. Click on the "Modeling" tab in the ribbon.

3. Click on "New Measure" under the "Calculations" group.

4. Enter a name for your measure, such as "IsAfter".

5. In the formula bar, enter the following DAX syntax:


IsAfter = IF(ISAFTER(Table1[Date1], Table1[Date2]), “TRUE”, “FALSE”)


Where:

- `Table1` is the name of the table containing your date columns

- `Date1` is the name of the column containing the date or time value you want to compare to `Date2`

- `Date2` is the name of the column containing the date or time value you want to compare `Date1` to

6. Click "Enter" to create the measure.

7. Add the measure to your report by dragging it onto a visual.

Examples

Let's say you have a table containing two date columns, "StartDate" and "EndDate", and you want to create a measure that returns a TRUE or FALSE value based on whether the EndDate is after the StartDate. You can do this using the ISAFTER function as follows:


IsAfter = IF(ISAFTER(Table1[EndDate], Table1[StartDate]), “TRUE”, “FALSE”)


Another example is if you have a table containing a "Date" column and you want to create a measure that returns a TRUE or FALSE value based on whether the date is after a specific date, such as January 1st, 2021. You can do this using the ISAFTER function as follows:


IsAfter = IF(ISAFTER(Table1[Date], “01/01/2021”), “TRUE”, “FALSE”)


The Power BI DAX function ISAFTER is a simple yet powerful tool that enables users to determine whether a specific date or time is after a given date or time. By using this function, you can create measures that return TRUE or FALSE values based on specific conditions, allowing you to gain deeper insights into your data.

Power BI DAX Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)