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!
Could you please confirm if the issue has been resolved? If not, feel free to reach out if you have any further questions.
Your update would be helpful for other members who may face a similar issue.
The Issue has been resolved Thanks