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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
JK-1
Helper II
Helper II

Multiple IF, AND conditions

Struggling with learning some of the basics and have researched online too but finding it hard to unravel. Grateful for any assistance in trying to formulate the below, columns 6 to 9.  Thanks in advance..

 

123456789     
DateStoreNumberLeaderSubsidySubsidy outcomeSubsidy ForecastOn AssessmentAssessment CountSubsidy Sum expecting (from 6 to 9) 
15/04/2025351Keith ON75TRUEIF subsidy outcome TRUE and IF Date[Column] AFTER (2025,4,6) , true: (2025,4,30) LESS Date[Column] calculation, false: 10  THEN multiply chosen number of days by Subsidy[Column]IF Leader CONTAINS "ON" and IF Subsidy[Column] between -100 to 100, true: 1, false: 0SUM count of ASSESSMENT[Column] using StoreNumberIF Assessment Count[Column] greater than 1 THEN using StoreNumber SUM Subsidy[Column], otherwise return 0 112512160
16/04/2025774Mark OFF-90FALSE         
17/04/202583Sharon OFF-95FALSE         
18/04/2025575Julie OFF-70FALSE         
19/04/2025192Scott OFF-60FALSE         
20/04/2025351Paula OFF-55FALSE         
21/04/2025575Barry OFF-75FALSE         
22/04/2025351Paula ON85TRUEIF subsidy outcome TRUE and IF Date[Column] AFTER (2025,4,6) , true: (2025,4,30) LESS Date[Column] calculation, false: 10  THEN multiply chosen number of days by Subsidy[Column]IF Leader CONTAINS "ON" and IF Subsidy[Column] between -100 to 100, true: 1, false: 0SUM count of ASSESSMENT[Column] using StoreNumberIF Assessment Count[Column] greater than 1 THEN using StoreNumber SUM Subsidy[Column], otherwise return 0 68012160
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @JK-1,

Thank you for reaching out in Microsoft Community Forum.

The only issue with the formula you posted is a small syntax error in the IF condition. In DAX, all conditions need to be separated by logical operators like &&, and each condition must return a TRUE/FALSE result.

please use the below DAX to resolve the error;

OnFlagCC =
IF (
SubsidyData[StoreNumber] = 83 &&
CONTAINSSTRING(SubsidyData[Leader], "ON") &&
SubsidyData[Subsidy] >= -100 &&
SubsidyData[Subsidy] <= 100,
1,
0
)

Please continue using Microsoft Community Forum.

If this post helps in resolve your issue, kindly consider marking it as "Accept as Solution" and give it a 'Kudos' to help others find it more easily.

Regards,
Pavan.

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi @JK-1,

I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, kindly "Accept  as  Solution" and give it a 'Kudos' so others can find it easily.

Thank you,
Pavan.

Anonymous
Not applicable

Hi @JK-1,

Thank you for reaching out in Microsoft Community Forum.

Thank you @maruthisp , @ryan_mayu   for the helpful response.

As suggested by maruthisp,  I hope this information was helpful. Please let me know if you have any further questions or you'd like to discuss this further. If this answers your question, please "Accept as Solution" and give it a 'Kudos' so others can find it easily.

Please continue using Microsoft community forum.

Regards,
Pavan.

maruthisp
Super User
Super User

Hi @JK-1 ,

I tried to implement the above scenario and please find the attached pbix file.
Multiple IF, AND conditions.pbix

Please let me know if you have further questions.

If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks! 

 

Best Regards, 

Maruthi 

LinkedIn - http://www.linkedin.com/in/maruthi-siva-prasad/ 

X            -  Maruthi Siva Prasad - (@MaruthiSP) / X

Thank you so much, seeing this presented helped me work through it in stages.

I see I had an initial conflict in that one leader's name contains On and also had an OFF  .. ie Sharon OFF but the logic has very much helped in unravelling.

 

The only other thing I had a different difficulty on was trying to combine queries within IF using other columns. Whilst I have seen &&   THEN ,  { }  etc I think I'm struggling with the basics on how to adapt where necessary..

Obviously don't want to take up more of your time with something that is probably simple, and not initially discussed in the opener.   Since you were very kindly able to help answer everything in the question(s) posed. Cheers,

JK1_0-1747605536849.png

combine .. use only on StoreNumber given, how to?

 

OnFlagCC =
IF(  SubsidyData[StoreNumber]="83"
    CONTAINSSTRING( SubsidyData[Leader], "ON" )
    && SubsidyData[Subsidy] >= -100
    && SubsidyData[Subsidy] <= 100,
    1,
    0
)
Anonymous
Not applicable

Hi @JK-1,

Thank you for reaching out in Microsoft Community Forum.

The only issue with the formula you posted is a small syntax error in the IF condition. In DAX, all conditions need to be separated by logical operators like &&, and each condition must return a TRUE/FALSE result.

please use the below DAX to resolve the error;

OnFlagCC =
IF (
SubsidyData[StoreNumber] = 83 &&
CONTAINSSTRING(SubsidyData[Leader], "ON") &&
SubsidyData[Subsidy] >= -100 &&
SubsidyData[Subsidy] <= 100,
1,
0
)

Please continue using Microsoft Community Forum.

If this post helps in resolve your issue, kindly consider marking it as "Accept as Solution" and give it a 'Kudos' to help others find it more easily.

Regards,
Pavan.

maruthisp
Super User
Super User

Hi JK-1,

Can you please provide more details about the calculation/formulas or business definition fo the new columns 6 to 9?

Please let me know if you have further questions.

If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks! 

 

Best Regards, 

Maruthi 

LinkedIn - http://www.linkedin.com/in/maruthi-siva-prasad/ 

X            -  Maruthi Siva Prasad - (@MaruthiSP) / X

ryan_mayu
Super User
Super User

@JK-1 

not clear about your explaination. could you pls also provide the expected output or provide the formula in excel for reference.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.