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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
bnjmnnl
Helper III
Helper III

Make a slicer with AND function

Hello all, 

 

For my report I need the user to be able to filter everything that is ONLY requested. So an AND function rather then an OR function. I will provide sample data below:

CustomerTbl

IDCustomer
1a
2b
3c

 

 

ActionTbl

IDArea
1BEL-162
1NLD-31
2NLD-31
2BEL-222
3NLD-31
3BEL-22
3BEL-222

 

AmountTbl

IDamount
1 € 1.500,00
2 € 1.600,00
3 € 1.800,00

 

The ID column represent transports. The area's are the places where the transport must load where there can  be multiple. If there are multiple area's, all the areas must take place. The amount table represents the revenue for each transport. I need a slicer where the user filters the area's and the outcome (the ID's and therefore the amounts) only contains the selected area's. 
So with current data, when the user filters for NLD-31, the user only wants to get a result with an ID where it ONLY contains NLD-31, so with this data wil return nothing. When the user selects NLD-31 and BEL-222, the user will only retreive ID = 2. When the user selects NLD-31 and BEL-222 and BEL-22, the user will only retreive ID = 3. 

I hope my explanation is clear and please ask for more information if needed. 
Thank you in advance! 

1 ACCEPTED SOLUTION

Hi @bnjmnnl ,

 

Here is the file you asked.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

7 REPLIES 7
MFelix
Super User
Super User

Hi @bnjmnnl ,

 

Add a table with the Area has a disconnected table then add the following measure to your model:

Validation = 

			IF(
				CONCATENATEX(
					 VALUES('Action'[Area]),
					'Action'[Area],
					",",
					'Action'[Area]
				) = CONCATENATEX(
					Area,
					Area[Area],
					",",
					Area[Area],
					ASC
				),
				1
			)

Now add this as a filter on your visual an select is not blank the slicer should be based on the new table:

MFelix_0-1729589437519.png

 

 

 

MFelix_1-1729589445107.pngMFelix_2-1729589451446.pngMFelix_3-1729589457891.png

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



bnjmnnl_0-1729590487151.png

Because I get this error

Hi @bnjmnnl,

 

Can you share the measure you have created?

 

It seems like a error on the code. Maybe a comma or lack of it somewhere. 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thank you for the answer! Can you please show the model view of your suggestion?

 

Hi @bnjmnnl ,

 

Here is the file you asked.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Kedar_Pande
Super User
Super User

Ensure that your tables (CustomerTbl, ActionTbl, AmountTbl) are properly related through the ID column

 

DAX Measure:

SelectedOnlyMeasure = 
VAR SelectedAreas = VALUES('ActionTbl'[Area]) // Get selected areas
VAR UniqueCount = DISTINCTCOUNT('ActionTbl'[Area]) // Count unique areas for the ID
VAR FilteredIDs =
CALCULATETABLE(
VALUES('ActionTbl'[ID]), // Get IDs based on the selected areas
FILTER(
'ActionTbl',
'ActionTbl'[Area] IN SelectedAreas
)
)
VAR MatchCount =
COUNTROWS(
FILTER(
'ActionTbl',
'ActionTbl'[ID] IN FilteredIDs // Only check the filtered IDs
)
)
RETURN
IF(
MatchCount = UniqueCount, // Check if count matches unique count
1, // Return 1 if they match
0 // Return 0 if they don't match
)

Set the visual filter to show items where SelectedOnlyMeasure is equal to 1.

 

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

Thank you! However this measure doe not make it happen so that the visual only displays the value where the selection is set to. If there are more area's and only one is selected it still shows that as the answer..

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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