Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I have a Data Set like this in PowerBI-
Category | Total Value | Sub_Category |
AB | 100 | A |
AB | 100 | B |
BC | 140 | B |
BC | 140 | C |
CX | 90 | C |
CX | 90 | X |
AX | 40 | A |
AX | 40 | A |
ABX | 200 | A |
ABX | 200 | B |
ABX | 200 | X |
I want to use a slicer like this- if I multi select A and B in Slicer It will show only the category which has only A and B present (Category AB,ABX from my example). How can I do it?
Solved! Go to Solution.
Hi @rif_data ,
I created a sample pbix file(see the attachment), please check if that is what you want.
1. Create a sub category dimension table(DO NOT create any relationship with your fact table)
Sub Categories = VALUES('Table'[Sub_Category])
2. Create a measure as below
Flag =
VAR _selsubcat =
ALLSELECTED ( 'Sub Categories'[Sub_Category] )
VAR _selcount =
COUNTROWS ( _selsubcat )
VAR _category =
SELECTEDVALUE ( 'Table'[Category] )
VAR _subcategory =
SELECTEDVALUE ( 'Table'[Sub_Category] )
VAR _count =
CALCULATE (
DISTINCTCOUNT ( 'Table'[Sub_Category] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Category] = _category
&& 'Table'[Sub_Category] IN _selsubcat
)
)
RETURN
IF ( _count = _selcount && _subcategory IN _selsubcat, 1, 0 )
3. Create a table visual
4. Apply a visual-level filter with the condition (Flag is 1) on the above able visual
Best Regards
Hi @rif_data ,
I created a sample pbix file(see the attachment), please check if that is what you want.
1. Create a sub category dimension table(DO NOT create any relationship with your fact table)
Sub Categories = VALUES('Table'[Sub_Category])
2. Create a measure as below
Flag =
VAR _selsubcat =
ALLSELECTED ( 'Sub Categories'[Sub_Category] )
VAR _selcount =
COUNTROWS ( _selsubcat )
VAR _category =
SELECTEDVALUE ( 'Table'[Category] )
VAR _subcategory =
SELECTEDVALUE ( 'Table'[Sub_Category] )
VAR _count =
CALCULATE (
DISTINCTCOUNT ( 'Table'[Sub_Category] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Category] = _category
&& 'Table'[Sub_Category] IN _selsubcat
)
)
RETURN
IF ( _count = _selcount && _subcategory IN _selsubcat, 1, 0 )
3. Create a table visual
4. Apply a visual-level filter with the condition (Flag is 1) on the above able visual
Best Regards
This is EXACTLY WHAT I AM LOOKING FOR! 😊
Thanks Mate!
Create a New Measure:
ShowCategory =
VAR SelectedSubCategories = VALUES('Table'[Sub_Category])
VAR CategorySubCategories =
CALCULATETABLE(
VALUES('Table'[Sub_Category]),
ALLEXCEPT('Table', 'Table'[Category])
)
VAR MatchCount = COUNTROWS(INTERSECT(SelectedSubCategories, CategorySubCategories))
VAR TotalSelected = COUNTROWS(SelectedSubCategories)
VAR TotalCategory = COUNTROWS(CategorySubCategories)
RETURN
IF(MatchCount = TotalSelected && MatchCount = TotalCategory, 1, 0)
Add this measure to the filter pane for the visual.
Set the filter to show only rows where ShowCategory = 1.
💌 If this helped, a Kudos 👍 or Solution mark ✅ would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn
Unfortunately this solution not working. 😦
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
10 | |
10 | |
9 | |
9 |
User | Count |
---|---|
20 | |
13 | |
12 | |
11 | |
8 |