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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Portrek
Resolver III
Resolver III

Table relationships - Active item in a given time period - Date start and date

Hello everyone, I have a problem.

The company where I work has divisions where several sectors are grouped according to a production they perform.

I am currently going back to my dashbords directly through the data flows and I came across a problem that I can not solve .. In order to maintain the history of changes, the system has a valve table of these blocks, similar to below.

pk.jpg

Using it I do the direct relationship with another that has the sectors, through the NR_PK key column, working perfectly through the filtering of these numbers ..

But there is a problem in relating the calendar of the dates, I can not do directly because it would only understand the dates pointed to the DT_INI column. As I do Pro Power BI understand that you should filter the NR_PK "1" for the entire period from 01/01/2012 to 12/31/2014 ???, and the NR_PK "10 for the period between 01/01 / 2015 to 05/09/2017! ???

For example if I filter randomly the date of 03/14/2012 he understood that the NR_PK is 1, and if I filter the date 01/01/2016 he will understand that the NR_PK should be 10 ..

Thank you in advanced for any help.

2 REPLIES 2
v-luwang-msft
Community Support
Community Support

HI @Portrek ,

Try  to  use the below measure:

time1 = 
var __date =SELECTEDVALUE('DATE'[Date])
return
	MAXX(
		FILTER(
			'Table',
			AND(
		    	'Table'[DT_INI]<= __date,
		    	__date <= 'Table'[DT_FIM]
		    )
		),
		'Table'[NR_PK]
	)

get:

vluwangmsft_0-1627958647863.pngvluwangmsft_1-1627958678654.png

 

 

Wish it is helpful for you!

 

Best Regards

Lucien

Greg_Deckler
Community Champion
Community Champion

@Portrek Seems like you need LOOKUPVALUE Range. https://community.powerbi.com/t5/Quick-Measures-Gallery/LOOKUPVALUE-Range/m-p/974201#M430

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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