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

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

Reply
Rabin25
Frequent Visitor

How to use filter selections in a measure

Hi guys, I am working on a measure that needs to use filter selections to calculate inventory. The model I have has three tables Branch, Hub, and Inventory. Hub and Branch are filters and Inventory has Qty column that I want to create a measure with. There are more than 40 branches, and some of those branches can also be considered as Hubs. 

Branch Table:

BranchIDBranchName
1Abc
2xyz
4mno
5pqr

 

Hub Table:

HubIDBranchName
1Abc
15sse
25eez
90rpq

 

Inventory:

BranchIDQty
115
225
450
510
15300
1820


I am working on a measure called Available_Territory where it needs to calculate the sum of quantities in the Inventory table based on what Branches and Hubs are selected in the filters. 

 

For example, if I have the following selections in the filters - 
Hub selection = 1,15
Branch selection = 1,2,5,18

Then the measure should calculate the sum of inventory quantity for the selected Hub and Branch IDs.
So the Available_territory = Calculate(SUM(Inventory[Qty]), FILTER(ALL(Inventory[BranchID]), Inventory[Qty] IN {1,15,2,5,18})
I tried capturing the filter selection using both SELECTEDVALUE() and ALLSELECED(), and putting them in a CALCULATETABLE() to use it in the measure, but it won't work. 

Here is the relationship model. I have not joined Hub to Inventory table as I want to use it just to capture HubIDs (which is same as branchid) and filter it in the Inventory[BranchID].

Rabin25_0-1717540294212.png

 




6 REPLIES 6
elitesmitpatel
Super User
Super User

Yes @lbendlin  is right just apppend or combine  Hub and Branch tables into a single table or if possible merge Inventory also it will sort all your problems

Rabin25
Frequent Visitor

Fyi, I found a solution for this. 

I captured the values selected in the slicers using ALLSELECTED() and assigned to a variable. I used that variable to create a list to capture multiple selection using CALCULATETABLE() and assigned to another variable X. 

Then I used the variable X to filter the fact table (Inventory) on Branch or Hub column. 

Anonymous
Not applicable

Hi @Rabin25 ,

 

Thanks for the reply from @lbendlin .

 

Was the method lbendlin provided helpful? Did it help you solve the problem?

 

If yes, please accept his answer as the solution, which will be of great help to users who encounter similar problems as yours.

 

If you have any further questions, please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

Rabin25
Frequent Visitor

Hub can also be a branch. For example BranchID 1 and HubID 1 are same location. There are only handful of Hubs but there are 40+ branches. HubID and BranchID both can be used to filter on Inventory[BranchID] because both of them are location ids. I need to find a way to combine the selected values in Hub and Branch filter, and use them to calculate inventory quantity for the selected hub and branch. 


Combine Hub and Branch tables into a single table, add a column indicating location type.

lbendlin
Super User
Super User

Why would the Hub table have a "BranchName"  column?

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.