March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
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.
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?
Solved! Go to Solution.
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:
For the related .pbix file,pls see attached.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
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:
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 🙂
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
127 | |
85 | |
69 | |
53 | |
44 |
User | Count |
---|---|
202 | |
106 | |
100 | |
64 | |
56 |