Forum Discussion
Power BI Dynamic Filter/Slicer
- 3 months ago
Hey PrasadSwamy007,
1) Create a disconnected slicer table
// DAX SlicerTable = DISTINCT('Table'[Source])2) Create this measure
Custom Sales = VAR SelectedSource = SELECTEDVALUE('SlicerTable'[Source]) RETURN CALCULATE( SUM('Table'[Sales]), FILTER( 'Table', 'Table'[Source] = SelectedSource || (SelectedSource = "XYZ" && 'Table'[Sub-Source] = "pack") ) )Key Results:
- For ABC / DEF - filters normally by Source
- For XYZ - also pulls in rows where Sub-Source = "pack"
- Disconnected table ensures the slicer doesn't auto-filter your fact table
Hope this helps!
Best,
Harshit
- 3 months ago
Hi,
As per our understanding your requirement, you need a custom slicer behavior where:
- Normally → filter by Source
- But when XYZ is selected → also include rows where Sub-Source = "pack" (even if Source ≠ XYZ)
So expected results:
- ABC → 10 + 20 + 30 = 60
- XYZ → 40 + 50 + 60 + pack(10 + 30) = 190
- DEF → 70 + 80 + 90 = 240
Recommended Solution (Measure-Based)
Create a disconnected slicer table:
Slicer_Source =
DISTINCT(TableName[Source])Use this table in your slicer.
Then create a measure:
Sales Dynamic =
VAR SelectedSource =
SELECTEDVALUE(Slicer_Source[Source])
RETURN
CALCULATE(
SUM(TableName[Sales]),
FILTER(
ALL(TableName),
TableName[Source] = SelectedSource
||
(
SelectedSource = "XYZ"
&& TableName[Sub-Source] = "pack"
)
)
)How it works
For normal selections (ABC, DEF):
Source = SelectedSource
works normally.
For XYZ:
It additionally includes:
Sub-Source = "pack"
So:
XYZ = 40 + 50 + 60 + 10 + 30 = 190
Setup Steps
- Create Disconnected Slicer Table
- Add it to slicer
- Create the Sales Dynamic measure
- Use measure in cards/charts/tables
Note:
Do not use your original Source column directly in slicer, otherwise Power BI’s normal filtering will interfere.Use the disconnected slicer table only.
This approach gives you fully dynamic custom filter logic
Hope this helps.
Thanks!
Hello,
I’m not completely sure, but I think the easiest way is to keep the slicer on Source and handle the special XYZ logic inside a measure with SWITCH or IF.
Something like, if selected source = "XYZ" then calculate Sales where Source = "XYZ" OR Sub-Source = "pack", otherwise just filter normally by Source. That should give you 190 for XYZ, 60 for ABC and 240 for DEF.
Best regards,
Daniele
Thank you Daniele
- v-priyankata3 months agoCommunity Support
Thank you for reaching out to the Microsoft Fabric Forum Community.
DanieleUgoCopp trivedisunita stoic-harsh SamInogic Thank you so much for your inputs.
I hope the suggestions from users have been helpful. Please confirm whether your issue has been resolved. If not, try the following steps.Since your matrix is already using Display_final, the SUM(Sales) measure was just an example to illustrate the filtering logic.
In your case, you wouldn't use the measure in the slicer or as a visual-level filter (=1). Instead, the same XYZ/pack logic would need to be applied to a new measure that references Display_final, and that measure should be used in the matrix Values.
If you're able to share the definitions of Display_2026 and total_2025_2026 it would help confirm the exact DAX needed, as the filtering behavior can depend on how those measures are written.
If there are any deviations from your expectation please let us know we are happy to address.
Thanks.
- v-priyankata3 months agoCommunity Support
Thank you for reaching out to the Microsoft Fabric Forum Community.
I hope the information provided was helpful. If you still have questions, please don't hesitate to reach out to the community.