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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Filter Logic Issue

Hi Folks,

 

I have the following DAX: 

 

Base Salary Grade = Switch(
True(),
Active[Base Salary %] = 0, "-",
Active[Base Salary  %] > 0 && Active[Base Salary %] < .80, "A",
Active[Base Salary  %] >= .80 && Active[Base Salary %] <= 1.20, "B",
Active[Base Salary  %] > 1.20, "C",
"TBD"
)

 

I have a need to exclude from this calculated column grades 100, 101, 102, and 103. The field is called "GRADE"

 

I tried Filter and NOT but it didn't seem to be working right. I must have some order mixed up but can't seem to get it right. Any help would be great please. 

 

Thank you!

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

Not sure I understand this completely but perhaps:

 

Base Salary Grade = Switch(
True(),
Active[GRADE] = 100 || Active[GRADE] = 101 || Active[GRADE] = 102 || Active[GRADE] = 103,BLANK(),
Active[Base Salary %] = 0, "-",
Active[Base Salary  %] > 0 && Active[Base Salary %] < .80, "A",
Active[Base Salary  %] >= .80 && Active[Base Salary %] <= 1.20, "B",
Active[Base Salary  %] > 1.20, "C",
"TBD"
)


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

4 REPLIES 4
Greg_Deckler
Super User
Super User

Not sure I understand this completely but perhaps:

 

Base Salary Grade = Switch(
True(),
Active[GRADE] = 100 || Active[GRADE] = 101 || Active[GRADE] = 102 || Active[GRADE] = 103,BLANK(),
Active[Base Salary %] = 0, "-",
Active[Base Salary  %] > 0 && Active[Base Salary %] < .80, "A",
Active[Base Salary  %] >= .80 && Active[Base Salary %] <= 1.20, "B",
Active[Base Salary  %] > 1.20, "C",
"TBD"
)


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...
Anonymous
Not applicable

Hi @Greg_Deckler,

 

The logic I posted is a calculated column based on the field "Base Salary %" on the Active table. I'm trying to say do the calculations in the DAX but don't do them when you come across grades 100, 101, 102, or 103. 

 

Hope this helps. 

Many thanks!

 

 

OK, then the above should work, or you would just wrap your SWITCH statement in an IF that checks the GRADES in the same manner (bunch of OR statements)



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...
Anonymous
Not applicable

Ah. That worked. That's totally not the way I was thinking of doing it initially and I overcomplicated it by a ton. I was trying to use a IF, FILTER, NOT statement. Doh. What's sad is that I thought of doing it the way you described but thought that was too easy. LOL. 

 

I need to start taking my own hunches for truth. LOL. Thanks for the help!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.