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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Lookup with date between multiple date ranges

Hi,

 

I'm running an email campaign analysis and need to lookup a date within a date range and then return the earliest value associated to it (otherwise there are multiple values and I get blank values)

 

Table 1

Email CampaignStart DateEnd Date
A14-Oct21-Oct
B15-Oct22-Oct
C26-Oct31-Oct

 

Table 2

 

Order Date
15-Oct
26-Oct

27-Oct

 

Desired Output

 

Order DateCampaign
15-OctA
16-OctA
27-OctC

 

This is because 15-Oct falls within two set out date ranges it takes the Campaign with the earlier Start Date.

 

I've tried using FIRSTNONBLANK but haven't got the desired result.

 

Any help would be appreciated.

 

 

2 REPLIES 2
kentyler
Solution Sage
Solution Sage

If you unpovited your first table

Email Campaign Date
Astart date14-Oct
Aend date21-Oct
Bstart date26-Oct

etc.
Then you could just get the MIN() start date associated with the campaign
rather than having to do multiple passes seeing which start/end date groups your order date fit into

I'm a personal Power BI trainer  I learn something every time I answer a question





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Anonymous
Not applicable

Thanks sir, so how would the lookup now work if I unpivot the table?

 

Which formula would I need to use to check if an order falls between the start and end date of a campaign?

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors