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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Gorgmaster
Regular Visitor

Something like LOOKUP with conditions

Hey there!

 

I've got a little Problem that I'm not able to solve. I need something like a LOOKUP with checking conditions. Like if something is between to time borders.

 

Here a little example:

I've got a first table with types and times. The table shows which type was produced during which time  period. So we have a start and an end.

TypesStartEnd
Type 101-01-2019 07:0001-02-2019 16:00
Type 201-02-2019 17:0001-03-2019 08:00
Type 301-03-2019 09:0001-04-2019 22:00

 

In a second table I've got events with a time stamp. Something like this:

EventTime
Event 101-01-2019 15:33
Event 201-03-2019 06:18
Event 301-03-2019 18:47

 

What I want to do is to combine these to tables. As an output I want the second table with the information which type was produced, when the event happend.

Output:

EventTimeType
Event 101-01-2019 15:33Type 1
Event 201-03-2019 06:18Type 2
Event 301-03-2019 18:47Type 3

 

So I've tried lookup and some if-conditions but always came to the same end: it doesn't work 😞

 

So anybody here who can help me?

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @Gorgmaster 

You can create a calculated column in the second table you show:

NewColType =
CALCULATE (
    DISTINCT ( Table1[Types] ),
    FILTER ( Table1, Table2[Time] >= Table1[Start] && Table2[Time] < Table1[End] )
)

 

Please mark the question solved when we get to the solution and consider kudoing if posts are helpful.

Cheers  Datanaut

View solution in original post

2 REPLIES 2
AlB
Community Champion
Community Champion

Hi @Gorgmaster 

You can create a calculated column in the second table you show:

NewColType =
CALCULATE (
    DISTINCT ( Table1[Types] ),
    FILTER ( Table1, Table2[Time] >= Table1[Start] && Table2[Time] < Table1[End] )
)

 

Please mark the question solved when we get to the solution and consider kudoing if posts are helpful.

Cheers  Datanaut

Thanks a lot! That was the solution I needed.

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.