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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Buzz1126
Helper III
Helper III

Filter Formula Help: And, with OR and Not Equal To

Hi everyone,

I need help creating a Calculate measure that contains AND, OR, and NOT EQAL TO.

I've got a bunch of products that I am trying to group into 3 categories:  high quaility, b, and other.  And then find the volumes for each of these categories.

I was able to create measures to get the first 2 categories (high quality & b).  I need help with the other category.

Here is my attempt.

 

// Gets a specefic a product qty
High Quality A Product Qty = CALCULATE(
	SUM(FactCPRGradesheetDetail[InvoiceQuantity]),
	FILTER(DimProduct,
		DimProduct[MainProductName] = "A1"
		)
		)

// gets all of the b product qty
B Product Qty = CALCULATE(
	SUM(FactCPRGradesheetDetail[InvoiceQuantity]),
	FILTER(DimProduct,
		DimProduct[NationalProductRollup] = "B"
		)
		)

// NEW MEASURE ATTEMPT:
// Want it to grab the rest of the products not mentioned above
Other Products Qty = CALCULATE(
	SUM(FactCPRGradesheetDetail[InvoiceQuantity]),
	FILTER(DimProduct,
		DimProduct[NationalProductRollup] = "C" ||
		DimProduct[NationalProductRollup] = "Other" ||
		// NEED TO GROUP THESE TOGETHER SOMEHOW?
		DimProduct[NationalProductRollup] = "A" &&
		DimProduct[MainProductName] <> = "A1"
		)

 

 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

Perhaps:

 

// NEW MEASURE ATTEMPT:
// Want it to grab the rest of the products not mentioned above
Other Products Qty = CALCULATE(
	SUM(FactCPRGradesheetDetail[InvoiceQuantity]),
	FILTER(DimProduct,
		DimProduct[NationalProductRollup] <> "A1" && 
		DimProduct[NationalProductRollup] <> "B"
		)

 

??


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

Perhaps:

 

// NEW MEASURE ATTEMPT:
// Want it to grab the rest of the products not mentioned above
Other Products Qty = CALCULATE(
	SUM(FactCPRGradesheetDetail[InvoiceQuantity]),
	FILTER(DimProduct,
		DimProduct[NationalProductRollup] <> "A1" && 
		DimProduct[NationalProductRollup] <> "B"
		)

 

??


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Man I feel dumb, thank you

Sometimes it just takes another set of eyes!!


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
smpa01
Super User
Super User

You can try something like this

 

 

TRY=
VAR 1= FILTER(DimProduct,
		DimProduct[NationalProductRollup] = "C" ||
		DimProduct[NationalProductRollup] = "Other")
VAR 2 = FILTER(DimProduct,
		DimProduct[NationalProductRollup] = "A" &&
		DimProduct[MainProductName] <> = "A1"
		)
VAR 3 = Union (1,2)

VAR 4 = Calculate (sumx(3,[InvoiceQuantity])
RETURN 4

 

@Buzz1126  

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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