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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Filter a column if 2 differents values are presents in differents lines of an another column

Hi guys,

 

I hope you're doing fine !

 

I have a table that I must keep only lines if the products belong to differents specific categories and I would want to apply this filter in the CALCULATE filter part :      Calculate( AVG(Price) ,....here.....)

Ideally, I should keep the products if the text of its differents Categories at differents lines contain "Unity...." and "Sub Unity..." 

 

You can see the result as below

Capture.PNG

We should do the average only for A and F cause its has differents categories

Thank you very much !

 

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

when you want to filter the table in that visual, you can try

Measure = CALCULATE(DISTINCTCOUNT('Table'[Category]),ALLEXCEPT('Table','Table'[Product]))

vxiaotang_0-1646637808232.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

when you want to filter the table in that visual, you can try

Measure = CALCULATE(DISTINCTCOUNT('Table'[Category]),ALLEXCEPT('Table','Table'[Product]))

vxiaotang_0-1646637808232.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

littlemojopuppy
Community Champion
Community Champion

Hi @Anonymous 
Try this...

CALCUALTE( 
	AVG(Price) ,
	OR(
		CONTAINSSTRING(Table[Category], "Unity"),
		CONTAINSSTRING(Table[Category], "Sub Unity")
	)
)
Anonymous
Not applicable

Hi 

I tried it and it do the average for every product and we should calculate only for the product A and F which has differents categories

@Anonymous 
Try this.  This doesn't work, you'll need to share data...

VAR	CurrentValue = SELECTEDVALUE(Table[Category])
RETURN

CALCUALTE( 
	AVG(Price) ,
	OR(
		CONTAINSSTRING(CurrentValue, "Unity"),
		CONTAINSSTRING(CurrentValue, "Sub Unity")
	)
)

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Kudoed Authors