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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors