Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sarikei
Helper I
Helper I

Selection from Slicer

Hi,

 

  1. 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.
  2. 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 6
JorgePinho
Solution Sage
Solution Sage

I think you can do it using an IF statement with SELECTEDVALUE function.

https://learn.microsoft.com/en-us/dax/selectedvalue-function

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.

 

Please provide an example to better understand your requirement.

Hi,

 

So I want to read the "From - To" date from the Slicer into the new measure.

Then I want use this Measure in another Visual, so the data selection in this Visual will be based on this Measure (which is From - To from the Slicer).

 

How to do this please? Thank you.

Hi,

 

Anyone can help please? Thanks.

MAwwad
Super User
Super User

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 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.