Forum Discussion

Dunner2020's avatar
Dunner2020
Post Prodigy
5 years ago
Solved

Enabling filter by check box

Hi there,   I have three filter measures (let say filter1, filter2, and filter3). I created a measure that calculates the number of events (let say the name of measure is [no of events]. I want to ...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Dunner2020 

    I think you can achieve your goal by building a unrelated slicer table and measure.

    Due to I don't know your data model I build a sample table to have a test.

    Sample Table:

    Slicer Table:

    Measure:

    No of Event = 
    VAR _Checkbox =
        SELECTEDVALUE ( Checkbox[Status] )
    VAR _YES =
        SUMX (
            FILTER (
                'Table',
                'Table'[Category1] = "A"
                    && 'Table'[Category2] = "BB"
                    && 'Table'[Category3] = "Event1"
            ),
            'Table'[QTY]
        )
    VAR _NO =
        SUM ( 'Table'[QTY] )
    RETURN
        IF (
            HASONEFILTER ( Checkbox[Status] ),
            IF ( _Checkbox = "Yes", _YES, _NO ),
            ""
        )

    Build a card visual to show the measure result. By default it will show blank, select "No", it will show sum of all QTY without filter, select "Yes", it will show results filtered by filter1 (Category1 = "A"), filter2 (Category2 = "BB") and filter3 (Category3 = "Event1").

    Result is as below.

    Select No:

    Select Yes:

    You can download the pbix file from this link: Enabling filter by check box

     

    Best Regards,

    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.