Forum Discussion

Julia2023's avatar
Julia2023
Icon for Helper I rankHelper I
7 months ago
Solved

Power BI Slicer

Hello, I am using the following value for a slicer:   Product Category = GENERATESERIES(5, 25, 50)   My goal is to have a default view where no value is applied, be...
  • cengizhanarslan's avatar
    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