Forum Discussion
Selection from Slicer
Hi,
- I have a Slicer defined in my report, it displays a list of predefine Date. i.e. This Month, Last Month, This Year, Last Year.
- I want to create the Measure to check if the selected value is “This Month”, then do something, else if the selected value is “This Year”, then do something, else do nothing. How can I do this?
Thanks in advance.
6 Replies
- MAwwadSolution Sage
Hello,
Logic as : If the value selected is = "This Month" then return 1
Else Return 0
Try this: If(Value(Date) = "This Month",1, If(Value(Date) = "This Year",2,etc.....
Or you can use SWITCH Case
Dont forget to accept this as a solution if it helped you 🙂
- JorgePinhoSolution Sage
I think you can do it using an IF statement with SELECTEDVALUE function.
https://learn.microsoft.com/en-us/dax/selectedvalue-function
- sarikeiHelper I
Thanks JorgePinho, Yes, I got it work as following!
MySelection = IF(
SELECTEDVALUE(DateTable[Date Selection]) = "This month",
"Yes","No"
)
Now, instead of “Yes”, if the selection is “This month”, I actually want to read the “From – To” date value from the other Slicer. And then group them together. Then I will use this measure in the other visual (bar chart). I know how to read the “From – To” value using:
MIN(DateTable[Date Selection])
MAX(DateTable[Date Selection])
But how can group all the value from this??
Many thanks.
- sarikeiHelper I
Hi,
Anyone can help please? Thanks.