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
JensKlöker
Helper I
Helper I

Create column with filters on several related tables

Hello there,

 

let's imagine there are couples (1 male & 1 female) which are doing some sport together.

 

I have got two tables. The first table "timestamps" contains timestamps at which the female did sport (without being necessary in partnership). This table contains the columns:

- TimestampID

- Timestamp

- FemaleID

 

The second table "partnerships" contains some partnerships with a start and an end of the partnership and ofcourse the FemaleID and the MaleID. So the columns are:

- ParntershipID

- FemaleID

- MaleID

- Start

- End (may be "null", which meens it is still "active")

 

What I want to do is to create a column "MaleID" in the first table. So in the first step I filter those partnerships, where the FemaleIDs in both tables match. In the second step I have to proove, which is the valid partnership for this case. So the timestamp has to be between Start and End. 

Some rows may be "null" in this new column, because the girls may not be in a partnership for specific timestamps.

 

I tried some things with

CALCULATE(Partnerships[Males];Filter(...))

but since I'm new to Power BI and DAX, I'm totally stuck at this point. May somebody help with the right hints, functions or formulas?

 

 

Best regards!

 

JayJay

2 REPLIES 2
JensKlöker
Helper I
Helper I

I also tried with LOOKUPVALUE but it does not applicable for logical comparisons which I need for start <= timestamp <= end comparison.

JensKlöker
Helper I
Helper I

Of course the FemaleID is connected in the relationships.

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.