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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
vishu263
Helper II
Helper II

DAX measure having multiple AND condition

Hello,

I am trying to create a DAX measure for the following logic.

=If ([OT] = "co" And ([BO Date] >= [PIS Date] And [EO Date] <= [PIE Date])) Then "Y" Else "N"

 

I have written the below DAX & it is working fine.

=IF(AND(MAX('SA'[OT])="co", SUM('SA'[BO Date])>=SUM('SA'[PIS Date])),"Y","N")

 

However, it is satisying only the first 'AND' condition.

I am getting an error while including the second AND condition (Highlighted above in bold). I have written the below DAX for that condition. Not sure if it is the correct way of writing a DAX.

=IF(AND(AND(MAX('SA'[OT])="co", SUM('SA'[BO Date])>=SUM('SA'[PIS Date]), SUM('SA'[EO Date])<=SUM('SA'[PIE Date]))),"Y","N")

 

Can somebody please tell how to correctly include the other AND condition in the above DAX.

 

Thanks in advance.

 

 

1 ACCEPTED SOLUTION
vishu263
Helper II
Helper II

Hello,

I have managed to get the solution by writing the below DAX.

 

=IF(AND(MAX('SA'[OT])="co", SUM('SA'[BO Date])>=SUM('SA'[PIS Date]) && SUM('SA'[EO Date])<=SUM('SA'[PIE Date])),"Y","N")

 

It works perfectly fine. However please feel free If somebody knows the better solution for this problem.

 

Thanks

View solution in original post

5 REPLIES 5
vishu263
Helper II
Helper II

Hello,

I have managed to get the solution by writing the below DAX.

 

=IF(AND(MAX('SA'[OT])="co", SUM('SA'[BO Date])>=SUM('SA'[PIS Date]) && SUM('SA'[EO Date])<=SUM('SA'[PIE Date])),"Y","N")

 

It works perfectly fine. However please feel free If somebody knows the better solution for this problem.

 

Thanks

vishu263
Helper II
Helper II

I appreciate your help @devanshi .

It seems to be a matter of closing parenthesis which is causing an issue, otherwise rest everything looks fine.

Thanks anyways.

 

@tamerj1 can you please have a look and share your views.

devanshi
Helper V
Helper V

IF(MAX('SA'[OT]="co"),
        SELECTEDVALUE('SA'[BO Date]>=SELECTEDVALUE('SA'[PIS Date]) &&  SELECTEDVALUE('SA'[EO Date]<=SELECTEDVALUE('SA'[PIE Date]),"Y","N")
If above will give error then try this:
MeasureName = IF([OT] = "co" && [BO Date] >= [PIS Date] && [EO Date] <= [PIE Date], "Y", "N")

 

Thank you @devanshi for proposing a solution. Unfortunately none of the above DAX is working in this case.

Try this ,
IF(MAX('SA'[OT]="co") &&

        SELECTEDVALUE('SA'[BO Date]>=SELECTEDVALUE('SA'[PIS Date]) &&  SELECTEDVALUE('SA'[EO Date]<=SELECTEDVALUE('SA'[PIE Date]),"Y","N")

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.