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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
gedal
Frequent Visitor

Display IDs that match all selections in one slicer

Hi
I have two tables that are connected:

1. warehouse dimension
2. inventory fact

I want to select various inventory elements in a slicer and only show the name of the warehouses that have all selected elements. 

Later I need to add an extra slicer that can be used as an OR input. SO that I can return the selections of multiple elements from one slicer OR the selection of multiple elements from another slicer. Both with the same values of inventory elements. 

gedal_0-1625739815035.png


I've tried to make use of this solution (can't make it work 😞) :
https://community.powerbi.com/t5/Desktop/Result-of-multiple-select-in-slicer-should-match-all-select...
and other solutions such as making a new table with distinct inventory elements and use it as slicer etc. List is getting long!

Does anyone have an idea of how to produce this or guide me in the right direction?

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi  @gedal ,

 

Create 2 measures as below:

Judge = 
var _count=CALCULATE(COUNT('Inventory fact table'[warehouse id]),FILTER(ALL('Inventory fact table'),'Inventory fact table'[element] in FILTERS('slicer table'[element])&&'Inventory fact table'[warehouse id]=MAX('Inventory fact table'[warehouse id])))
Return
IF(_count<COUNTX(ALLSELECTED('slicer table'[element]),'slicer table'[element]),BLANK(),_count)
Return = 
var _warehouseid=CALCULATETABLE(VALUES('Inventory fact table'[warehouse id]),FILTER(ALL('Inventory fact table'),'Inventory fact table'[element] in FILTERS('slicer table'[element])&&'Inventory fact table'[Judge]<>BLANK()))
var _name=CALCULATETABLE(VALUES('warehouse dimension table'[warehouse name ]),FILTER(ALL('warehouse dimension table'),'warehouse dimension table'[warehouse id ] in _warehouseid))
Return
CONCATENATEX(_name,'warehouse dimension table'[warehouse name ],",")

And you will see:

vkellymsft_3-1626060742193.png

 

vkellymsft_2-1626060728427.png

vkellymsft_4-1626060752239.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

 

View solution in original post

2 REPLIES 2
v-kelly-msft
Community Support
Community Support

Hi  @gedal ,

 

Create 2 measures as below:

Judge = 
var _count=CALCULATE(COUNT('Inventory fact table'[warehouse id]),FILTER(ALL('Inventory fact table'),'Inventory fact table'[element] in FILTERS('slicer table'[element])&&'Inventory fact table'[warehouse id]=MAX('Inventory fact table'[warehouse id])))
Return
IF(_count<COUNTX(ALLSELECTED('slicer table'[element]),'slicer table'[element]),BLANK(),_count)
Return = 
var _warehouseid=CALCULATETABLE(VALUES('Inventory fact table'[warehouse id]),FILTER(ALL('Inventory fact table'),'Inventory fact table'[element] in FILTERS('slicer table'[element])&&'Inventory fact table'[Judge]<>BLANK()))
var _name=CALCULATETABLE(VALUES('warehouse dimension table'[warehouse name ]),FILTER(ALL('warehouse dimension table'),'warehouse dimension table'[warehouse id ] in _warehouseid))
Return
CONCATENATEX(_name,'warehouse dimension table'[warehouse name ],",")

And you will see:

vkellymsft_3-1626060742193.png

 

vkellymsft_2-1626060728427.png

vkellymsft_4-1626060752239.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

 

Thank you so much! this was really great!

I needed the warehouses on individual row, so that I can add extra information to each displayed warehouse. So I changed the code a little and made it into a flag instead.

The return measure is now:

ifcointainswarehouse =

Var selection = SELECTEDVALUE(consultants[Konsulent])

var _warehouseid1=
CALCULATETABLE(
VALUES('Inventory fact table'[warehouse id]),
FILTER(ALL('Inventory fact table'),
'Inventory fact table'[element] in FILTERS('elementFilter1'[Element]) && 'Inventory fact table'[Judge1]<>BLANK()
)
)

var _name1=
CALCULATETABLE(
VALUES('warehouse dimension table'[warehouse name ]),
FILTER(
ALL('warehouse dimension table'),
'warehouse dimension table'[warehouse id] in _warehouseid1))

var _warehouseid2=
CALCULATETABLE(
VALUES('Inventory fact table'[warehouse id]),
FILTER(ALL('Inventory fact table'),
'Inventory fact table'[element] in FILTERS('elementFilter2'[Element]) && 'Inventory fact table'[Judge2]<>BLANK()
)
)

var _name2=
CALCULATETABLE(
VALUES('warehouse dimension table'[warehouse name ]),
FILTER(
ALL('warehouse dimension table'),
'warehouse dimension table'[warehouse id ] in _warehouseid2))

VAR check =
IF(
CONTAINS(_name1, 'warehouse dimension table'[warehouse name ], selection),
1,
IF(
CONTAINS(_name2, 'warehouse dimension table'[warehouse name ], selection),
1,
0
)
)

RETURN check

Then I make a table with all warehouses from the dimension table and filter it with the return measure 🙂

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.