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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
NISH72
Helper IV
Helper IV

Dax for multiple (and,or) statement

Hi can someone suggest dax for the following statement
Sales value < 90 and either
3+ sales rating AND 4+ salesman OR
5+ sales rating AND 1+ salesman
Actually I wanted to add a filter in power bi but the filter won't satisfy all the condition at once. Please help me with dax for these. Thank you
2 ACCEPTED SOLUTIONS
Nathaniel_C
Super User
Super User

Sales value < 90 and either
3+ sales rating AND 4+ salesman OR
5+ sales rating AND 1+ salesman

If(Sales value <90 && sales rating >=3 && salesman >=4 || Sales value <90 && sales rating >=5 && salesman >=1,1,0)

Hi @NISH72 ,
If I understand what you are looking for you can use && and || .
https://docs.microsoft.com/en-us/dax/dax-operator-reference 
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





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

Proud to be a Super User!




View solution in original post

Greg_Deckler
Super User
Super User

You could do it with a FILTER like:

 

VAR __table = 
  FILTER(
    Sales value < 90 && 
      ( Sales rating >= 3 && Salesman >= 4 || 
          Sales rating >= 5 && Salesman >= 1
      )
  )

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

You could do it with a FILTER like:

 

VAR __table = 
  FILTER(
    Sales value < 90 && 
      ( Sales rating >= 3 && Salesman >= 4 || 
          Sales rating >= 5 && Salesman >= 1
      )
  )

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Thank you for your reply. When I use this dax I get the following error- 'expression refers to multiple column. Multiple column cannot be converted to scalar values.
Nathaniel_C
Super User
Super User

Sales value < 90 and either
3+ sales rating AND 4+ salesman OR
5+ sales rating AND 1+ salesman

If(Sales value <90 && sales rating >=3 && salesman >=4 || Sales value <90 && sales rating >=5 && salesman >=1,1,0)

Hi @NISH72 ,
If I understand what you are looking for you can use && and || .
https://docs.microsoft.com/en-us/dax/dax-operator-reference 
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





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

Proud to be a Super User!




Thank you for your reply. After I use this dax the sales rating and salesman fields are still showing below 3 values even though sales values is showing correct i.e below 90

Hi @NISH72 ,

Please read this post to get your question answered more quickly:

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Please provide us with a pbix, or a table to show us what you are doing.

Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





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

Proud to be a Super User!




Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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