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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
GM30
Frequent Visitor

How to return one value underneath the max value of a date slicer?

Is there a way to create a filter, measure, or column that would reference the max date in a slicer, then return the date of the last day prior within the dataset? 

One difficulty to my problem is that my date values are only business days (monday through friday). So, if I were to set the max value of the slider to 2/5/24 (a monday) I would want the value for 2/2/24 (the previous friday).

Any help or suggestions would be greatly appreciated!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @GM30 ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1707273750091.png

(2) We can create a slicer table.

SlicerTable = VALUES('Table'[Time Series])

(3) We can create a calculated column and a measure.

Index = RANKX('Table','Table'[Time Series],,ASC,Dense)
Time = 
var _date=CALCULATE(MAX('SlicerTable'[Time Series]),ALLSELECTED('SlicerTable'))
 var _a=CALCULATE(MAX('Table'[Index]),FILTER(ALLSELECTED('Table'),'Table'[Time Series]=_date))
 var _b=CALCULATE(MAX('Table'[Time Series]),FILTER(ALLSELECTED('Table'),'Table'[Index]=_a-1))
 RETURN _b

(3) Then the result is as follows.

vtangjiemsft_1-1707273996271.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

4 REPLIES 4
Anonymous
Not applicable

Hi @GM30 ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1707273750091.png

(2) We can create a slicer table.

SlicerTable = VALUES('Table'[Time Series])

(3) We can create a calculated column and a measure.

Index = RANKX('Table','Table'[Time Series],,ASC,Dense)
Time = 
var _date=CALCULATE(MAX('SlicerTable'[Time Series]),ALLSELECTED('SlicerTable'))
 var _a=CALCULATE(MAX('Table'[Index]),FILTER(ALLSELECTED('Table'),'Table'[Time Series]=_date))
 var _b=CALCULATE(MAX('Table'[Time Series]),FILTER(ALLSELECTED('Table'),'Table'[Index]=_a-1))
 RETURN _b

(3) Then the result is as follows.

vtangjiemsft_1-1707273996271.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

Is there a way to keep the 1 beneath the max value while using a date slicer that is set to between? As I have other metrics on the page that are calculated over a period of time (such as a year)

selimovd
Super User
Super User

Hey @GM30 ,

 

how does your data table look like?

 

Best regards

Denis

GM30
Frequent Visitor

The data looks like the following although the avg fields are calculating their respecitve averages:

My main goal is to retrieve the 1 date below the max date according to an adjusting slicer. Then, I want to use that value to filter cards that display the Q1_AVG and Q2_AVG values.

Time Series:Month 1Month2Month3Month4Month5Month6Q1_AVGQ2_AVG
2/6/24123456AVG(month1,month2,month3)Avg(month4,month5,month6)
2/5/24123456  
2/2/24123456  
2/1/24123456  

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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