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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
JollyRoger01
Helper III
Helper III

How to replicate the LOOKUP Excel formula in DAX (Excel 2016)

I am trying to replicate the LOOKUP formula in Excel that will return the Reporting Period End date for a date that falls between the Reporting Period Start Date and Reporting Period End Date. This is a fairly simple calc, but I have no idea how to do this in DAX. LOOKUPVALUE is not what I am looking for as it doesn't do greater than or equal two, that I know of. Workbook is below.

 

Book1 

 

 

1 ACCEPTED SOLUTION
JollyRoger01
Helper III
Helper III

This is the formula I was looking for:

=
CALCULATE
	(
	VALUES
		(
		XREF_ReportingPeriods[Reporting Period End]
		),
		FILTER
			(
			XREF_ReportingPeriods,
			[Date] >= XREF_ReportingPeriods[Reporting Period Start]
			&& 
			[Date]  <= XREF_ReportingPeriods[Reporting Period End]
			)
	)

View solution in original post

5 REPLIES 5
JollyRoger01
Helper III
Helper III

This is the formula I was looking for:

=
CALCULATE
	(
	VALUES
		(
		XREF_ReportingPeriods[Reporting Period End]
		),
		FILTER
			(
			XREF_ReportingPeriods,
			[Date] >= XREF_ReportingPeriods[Reporting Period Start]
			&& 
			[Date]  <= XREF_ReportingPeriods[Reporting Period End]
			)
	)
Jihwan_Kim
Super User
Super User

Picture1.png

 

end date in the period : =
IF (
HASONEVALUE ( Dates[Date] ),
MAXX (
FILTER (
Periods,
MAX ( Dates[Date] ) >= Periods[Reporting Period Start]
&& MIN ( Dates[Date] ) <= Periods[Reporting Period End]
),
Periods[Reporting Period End]
)
)

 

 

Link to the PBIX file 

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

I have tried this, after changing all the table names to match mine, but I cannot get it to work (all the values are blank). I am adding it to a calculated column to Table_Historical.

wdx223_Daniel
Super User
Super User

wdx223_Daniel_0-1626844153958.png

 

I am looking to add this as a calculated column called Reporting Period End Dtate in Table_Historical. Do you know how I can do this, using the same names I have used?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.