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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
nirvana_moksh
Impactful Individual
Impactful Individual

Measure to filter correct date from another table

Hello All,

 

I am running into an issue creating this measure which is driving me nuts. For this example, I have two tables. One has a List of Dates which is used as a filter as below:

Untitled.png

which when filtered to one date as above 05.10.2018 looks up other table's start dates and it returns the minimum of that range's start. For example, when 05.10.2018 is selected it should return 05.09.201, but when 05.16.2018 on the filter is selected it returns 05.15.2018 as that is the minimum date close to it.

 

GROUP IDVALUE DATESTART DATEEND DATE
13003/9/20235/9/20185/14/2018
13005/9/20235/15/2018NULL

 

 

LIST DATES (Filter field)
5/1/2018
5/2/2018
5/3/2018
5/4/2018
5/5/2018
5/6/2018
5/7/2018
5/8/2018
5/9/2018
5/10/2018
5/11/2018
5/12/2018
5/13/2018
5/14/2018
5/15/2018
5/16/2018
5/17/2018

 

I tried and wrote something like IF(SELECTEDVALUE('List Date'[Date] <= MIN(Start Date), MIN(Start Date),"-") but that did not work, any help would be appreciated.

 

Thank You

6 REPLIES 6
parry2k
Super User
Super User

@nirvana_moksh your request is not clear, isn't when 5/16/2018 selected, it should return 5/15/2018 instead of 5/14/2018???



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k- Sorry about that, I have edited and corrected my post now



 

@nirvana_moksh try adding following measure

 

Recent Date = 
VAR __baseDate = SELECTEDVALUE('List Date'[Date])
RETURN
CALCULATE( MAX(Table[Start Date]), Table[Start Date] <= __baseDate )

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k - Sadly that did not work, I had tried something similar as well and I think what it ends up doing is checking MAX os the start dates instead of seeing it in relation to the filter selected. Below is what it returned when I used the measure suggested:

Untitled.png

 

@nirvana_moksh doesn't make sense, share the pbix file thru one drive/google drive, remove any sensitive inforamtion



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k - Extracted the small data set from these two tables for your reference, there are actually 10 tables and lot of relationships, but I think this covers it basically for these two. Thanks!!!

 

https://1drv.ms/f/s!Au9CSosUldp9hE-ZyXFm9ppRHpF1

 

 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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