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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

max value selected in date slicer

I have a date slicer, I need to get the max of the date select to pass it as a parameter of a dax function :

 

I tried :

 

selected_date= CALCULATE(max('Calendar'[date]);(ALLSELECTED('Calendar'))

 

Table= Filter (CURRENCY_RATE; CURRENCY_RATE[Date]=selected_date)


in this example:

 

dateslicer.JPG

 


I would like to filter the table on the last value selected (=13/06/2017)

 

currency_rate.JPG

 

and get only this row:

 

row.JPG

 

could you please help me how can I do it?

 

Thanks in advance

1 ACCEPTED SOLUTION
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

If you want to create a new table and make it be dynamic with the slicer, I am afraid you could not achieve this feature currently, you could try to use the Top N filter in the visual filter to get your desired result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
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

9 REPLIES 9
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

https://community.powerbi.com/t5/Desktop/max-value-selected-in-date-slicer/m-p/571351#M269765

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

If you want to create a new table and make it be dynamic with the slicer, I am afraid you could not achieve this feature currently, you could try to use the Top N filter in the visual filter to get your desired result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

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

Hi,

 

Assuming you have a Calendar Table and a relationship from the Date column of the Currency_Rate Table to the Date column of the Calendar Table, try this measure to get the rate on the last date of the date selected in the slicer range.  Ensure that the slicer is built from the Calendar Table

 

=CALCULATE(MAX(Currency_Rate[Currency_rate]),DATESBETWEEN(Calendar[Date],MAX(Calendar[Date]),MAX(Calendar[Date])))

 

Does this help?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

What if you don't have the relationship between the calendar and that particular table ? How would you propose to get the max and min of the selectedvalue form the slicer? 

There should definitely be a Calendar Table.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

The return value of the function is "currency code".

But I want to select all rows corresponding to the max value selected in "slicer date".

 

This DAX formula works but isn't dynamic in relation to the selected value (slicer date).

 

Table 2 = filter(CURRENCY_RATE; CURRENCY RATE[VALID_FROM]=DATEVALUE("30/04/2017"))

 

This should be dymanic : DATEVALUE("30/04/2017") 

 

 

 

 

Hi,

 

Does this work?

 

Table 2 = filter(CURRENCY_RATE; CURRENCY RATE[VALID_FROM]=MAX(Calendar[Date]))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi,

 

The issue here is that this part "MAX(Calendar[Date])" returns the most recent date (the last date in the whole Calendar range date) but not the last date selected with the slicer selection.

 

I have managed to get the correct date value (the last date selected with the slicer) by using a Measure but thateasure cannot be used here because it does not return the same value when used as a FilterExpression.

 

I understand that the underlying problem is the context of that Measure but I don't understand how to use Earlier() in that situation since you can't use that function with a Measure as a parameter.

Can you please tell, what change you did to the measure to get last date selected with the slicer selection and not the max date present in the calendar date 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors