Forum Discussion

tmul's avatar
tmul
Frequent Visitor
5 years ago
Solved

Measure to use range slicer which can include blanks

Hi,  I would like to use a slicer [tick box] to allow the user to decide if he wants to see only the values from a range slicer or in addition blank values.  I have a dataset with a range of number...
  • MFelix's avatar
    5 years ago

    Hi tmul ,

     

    Create a table with the values and another with the slicer:

    SLICER VALUES = FILTER( DISTINCT('Table (2)'[Value]), 'Table (2)'[Value] <> BLANK())

    This table should be used for the slicer of the values.

     

    Now add the following measure:

    Total Value =
    SWITCH (
        TRUE (),
        SELECTEDVALUE ( 'Show/Blanks'[Blank] ) = "Yes"
            && SUM ( 'FACTTABLE'[Value] ) = BLANK (), "",
        SELECTEDVALUE ( 'Show/Blanks'[Blank] ) = "Yes"
            && CALCULATE (
                SUM ( 'FACTTABLE'[Value] ),
                'FACTTABLE'[Value] IN VALUES ( 'SLICER VALUES'[Value] )
            )
                <> BLANK (),
            CALCULATE (
                SUM ( 'FACTTABLE'[Value] ),
                'FACTTABLE'[Value] IN VALUES ( 'SLICER VALUES'[Value] )
            ),
        SELECTEDVALUE ( 'Show/Blanks'[Blank] ) = "No",
            CALCULATE (
                SUM ( 'FACTTABLE'[Value] ),
                'FACTTABLE'[Value] IN VALUES ( 'SLICER VALUES'[Value] )
            )
    )

     

    Has you can see below and in the attach file the selection show and hides the blanks: