Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
JustinDoh1
Post Prodigy
Post Prodigy

How to express this in DAX

I am trying to express this condition in DAX.

 

Table.ImmunizationDate > Table.ConsentDate

 

JustinDoh1_0-1629144870152.png

 

They are located in different row context (different row).

But, both have common which is Step = 1

 

However, to distinguish two better,

ImmunizationDate has "Historical" as Consent

ConsentDate has "Refused" as Consent

 

 

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @JustinDoh1 ,

 

I'm not really sure how the result should look like. I just guessed you want to return a 1 if Table.ImmunizationDate > Table.ConsentDate and a 0 if not.

Try the following measure:

Immunization after Consent =
VAR vImmunization =
    CALCULATE(
        MAX( myTable[ImmunizationDate] ),
        ALLEXCEPT(
            myTable,
            myTable[Step]
        )
    )
VAR vConsent =
    CALCULATE(
        MAX( myTable[ConsentDate] ),
        ALLEXCEPT(
            myTable,
            myTable[Step]
        )
    )
RETURN
    IF(
        vImmunization > vConsent,
        1,
        0
    )

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

1 REPLY 1
selimovd
Super User
Super User

Hey @JustinDoh1 ,

 

I'm not really sure how the result should look like. I just guessed you want to return a 1 if Table.ImmunizationDate > Table.ConsentDate and a 0 if not.

Try the following measure:

Immunization after Consent =
VAR vImmunization =
    CALCULATE(
        MAX( myTable[ImmunizationDate] ),
        ALLEXCEPT(
            myTable,
            myTable[Step]
        )
    )
VAR vConsent =
    CALCULATE(
        MAX( myTable[ConsentDate] ),
        ALLEXCEPT(
            myTable,
            myTable[Step]
        )
    )
RETURN
    IF(
        vImmunization > vConsent,
        1,
        0
    )

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.