Forum Discussion
Jayasimha
4 years agoFrequent Visitor
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...
- 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 regardsDenisBlog: WhatTheFact.biFollow me: twitter.com/DenSelimovic
Jayasimha
4 years agoFrequent Visitor
Hi selimovd,
Thank you for taking time and going through my question.
In the slicer I want to give only Yes or ALL(including both Yes and No). I don't want to give the user an option to select No as the revenue doesn't make sense when selected only for No.
Can a new column be included in slicers?
selimovd
Most Valuable Professional
4 years agoOK, 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
Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic