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, because selecting a value affects my measures. At the same time, I need to keep the slicer in single value style, so that users can manually enter or select a single value when needed. Do you know if there is a way to configure the slicer or model so that, by default, no value is selected and the slicer does not impact my measures, but still allows single‑value selection later?

Thank you in advance.

  • 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

     

5 Replies

  • 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

     

  • I am not sure that you can set a default no value in a single select slicer. Have you considered using a single value parameter? It would allow the user to enter a value and could be set to no value when you save and publish your report.

  • Julia2023 

     

    Is your product category dax correct? it only shows 5.

     

    could you pls provide some sample data and expected output?

     

    maybe we can use DAX to do that 

     

    here is an example for you, if we don't select any value, it shows 1, if you select one value, it will shows the corresponding output.

     

     

    pls see the attachment below

  • Hi Julia2023 

    A What-if parameter table (as others have suggested) is the way to go. It generates a table using a formula similar to the one you created manually, but it also adds a column property that enables a single-value style slicer and allows an empty selection. A calculated table on its own doesn’t include that property, so it won’t behave the same way—unless the property is added later using an external tool like Tabular Editor which must be installed separately (TE2 is free).

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Julia2023 ,

     

    Thank you cengizhanarslan for the response provided!

    Has your issue been resolved? If the response provided by the community member addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.


    Best Regards,
    Tejaswi.
    Community Support