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
Anonymous
Not applicable

Capture the maximum selected value of a slicer and use it in another measure

Hi,

 

My data has 2 columns. Week number and value.

 

weekvalue
132
252
332
43
54445
636

 

I have a slicer for week number. What Im trying to do is capture the maximum value of the slicer, so for example if the user selected the range of the slicer to be from 2 to 5. I want to take the 5 and subtract 2 from it, and then compare the answer with my table and put a yes whenever the answer = the week column value.

 

I have created 2 measures:

Measure 2 = MAX(Sheet1[week])-2
measure test = IF(measure 2 = max(Sheet1[week]) , "Yes","No")

 

The desired output should look like this:

 

weekvalueMeasure Test
132no
252no
332yes
43no
54445no
636no

 

But what Im getting instead is that all values are getting a "no". What I fugured is that instead of capturing one value (max slicer - 2) and comparing it with all records, its actually subtracting 2 from each record and then compare it with the original record.

 

Your help is highly appreciated.

Thank you

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi  @Anonymous 

Just adjust the [measure 2] as below:

Measure 2 = CALCULATE(MAX(Sheet1[week]),ALLSELECTED(Sheet1))-2

Result:

1.JPG

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

hi  @Anonymous 

Just adjust the [measure 2] as below:

Measure 2 = CALCULATE(MAX(Sheet1[week]),ALLSELECTED(Sheet1))-2

Result:

1.JPG

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

Refer

measure test = 
var _max =MAXX(Sheet1,Sheet1[week])-2
return
IF( max(Sheet1[week]) =_max, "Yes","No")
Anonymous
Not applicable

Hi  ,

 

I have used the suggested measure but its still giving "no" for all records. As you can see in the screenshots below:

 

 
 

Capture.PNG

 

Capture2.PNG

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.