Forum Discussion
Power BI Slicer
- 7 months ago
1) Create the slicer table with an “All” option
GENERATESERIES(5,25,50) actually returns only 5 (because step > range). I assume you meant something like 5–25 step 5, or similar. Here’s a clean example with 5..25 step 5:
Product Category = UNION ( ROW ( "Value", BLANK(), "Label", "(All)" ), SELECTCOLUMNS ( GENERATESERIES ( 5, 25, 5 ), "Value", [Value], "Label", FORMAT ( [Value], "0" ) ) )Use Label in the slicer (so users see “(All), 5, 10, …”)
Keep slicer Single select = On
Default selection = “(All)” (or leave it as the first item users naturally see)
2) In your measures, treat BLANK as “no filter”
Example pattern:
Measure = VAR t = SELECTEDVALUE ( 'Product Category'[Value] ) RETURN IF ( ISBLANK ( t ), [Base Measure], CALCULATE ( [Base Measure], Fact[ProductCategory] = t ) )Now:
Default “(All)” ⇒ t is BLANK ⇒ measure behaves as if nothing is selected
User picks a number ⇒ measure applies the logic
1) Create the slicer table with an “All” option
GENERATESERIES(5,25,50) actually returns only 5 (because step > range). I assume you meant something like 5–25 step 5, or similar. Here’s a clean example with 5..25 step 5:
Product Category =
UNION (
ROW ( "Value", BLANK(), "Label", "(All)" ),
SELECTCOLUMNS (
GENERATESERIES ( 5, 25, 5 ),
"Value", [Value],
"Label", FORMAT ( [Value], "0" )
)
)
Use Label in the slicer (so users see “(All), 5, 10, …”)
Keep slicer Single select = On
Default selection = “(All)” (or leave it as the first item users naturally see)
2) In your measures, treat BLANK as “no filter”
Example pattern:
Measure =
VAR t = SELECTEDVALUE ( 'Product Category'[Value] )
RETURN
IF (
ISBLANK ( t ),
[Base Measure],
CALCULATE (
[Base Measure],
Fact[ProductCategory] = t
)
)Now:
Default “(All)” ⇒ t is BLANK ⇒ measure behaves as if nothing is selected
User picks a number ⇒ measure applies the logic