Forum Discussion

Begbie's avatar
Begbie
Helper I
4 years ago
Solved

Filter data in table based on silcer

Hi All,   I'm hoping someone can point me in the right direction here, as my PBI isn't the best.    Currently, I have a report that has a slicer in it, with options of:   Secure API Secure Cod...
  • PaulDBrown's avatar
    PaulDBrown
    4 years ago

    Try creating a measure to use as a filter for the visual. You will need an independent table for the slicer selection

    Let the independent table values be DSlicer[Value], the fact table be FactTable and the selection column be FactTable[Selection])

     

    Filter measure =
    SWITCH (
        SELECTEDVALUE ( DSlicer[Value] ),
        "Secure API",
            COUNTROWS (
                CALCULATETABLE ( FactTable, FactTable[Selection] IN { "Devops", "CD" } )
            ),
        "Secure Code",
            COUNTROWS (
                CALCULATETABLE (
                    FactTable,
                    FactTable[Selection] IN { "Devops", "CD", "Classic" }
                )
            ),
        "Secure Infrastructure",
            COUNTROWS (
                CALCULATETABLE ( FactTable, FactTable[Selection] IN { "Classic" } )
            )
    )

     

    Select the visual and add this measure as a filter, setting the value to greater or equal to 1

  • Begbie's avatar
    Begbie
    4 years ago

    PaulDBrown 

     

    Just wanted to say thank you for the above and this seems to have resolved my issue 😀

     

    No idea how you guys do it and have all this knowledge, but the above solution with the measure helped achieve what I wanted, so a big thank you from me!!