Forum Discussion

Jayasimha's avatar
Jayasimha
Frequent Visitor
4 years ago
Solved

Exclude/Include measure in slicer based on Yes/No column

Hello, I have a column in my data which has Yes or No. Below is a sample Accounts? Revenue Yes xxx Yes xxx No xxx   I was trying to create a measure and put it into a slicer. I...
  • selimovd's avatar
    selimovd
    4 years ago

    OK, now I get it 😊

    Then your approach with the new table should work.

    Then create the following measure:

    Yes/No =
    VAR vSlicerValue = SELECTEDVALUE ( 'NewTable'[Include/Exclude] )
    RETURN
        SWITCH (
            vSlicerValue,
            "Exclude",
                CALCULATE (
                    SUM ( Data[Revenue] ),
                    Data[Accounts?] = "Yes"
                ),
            "Include", SUM ( Data[Revenue] )
        )
    

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis