cancel
Showing results for
Did you mean:

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Anonymous
Not applicable

## Filter Logic Issue

Hi Folks,

I have the following DAX:

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
Super User

Not sure I understand this completely but perhaps:

```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"
)```

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
4 REPLIES 4
Super User

Not sure I understand this completely but perhaps:

```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"
)```

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

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!

Super User

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)

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
The Definitive Guide to Power Query (M)

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!

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

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

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors