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
gunasai
Helper I
Helper I

Best way to relate/join 3 tables on Power BI (To filter rows/values).

Hi guys,

 

I have the following 3 tables,

 

Table 1: Users

IDUser Name
1abc
2efg
3xyz

 

Table 2: Time_track

IDUser NameLogin DateTotal_log_time (min)No_of_sessions
1abc2021-08-024359
1abc2021-08-033352
1abc2021-08-042656
3xyz2021-08-022634
3xyz2021-08-032645
3xyz2021-08-042654

 

Table 3: Picks table

Order NumberItem numberQty_pickedPickTimeUser_id
11111202021-08-02 10:00:00abc
11112302021-08-02 11:00:00abc
11113402021-08-02 12:00:00abc
22224502021-08-03 7:00:00abc
22225602021-08-04 8:00:00abc
33336102021-08-02 10:00:00xyz
33337202021-08-02 12:30:00xyz
44448302021-08-03 1:00:00xyz
44449402021-08-04 4:00:00xyz

 

Now I can relate Table 1 (Users table) and Table 2 (Time_track table) in a "1 to many" relationship on "ID" to filter rows OR Table 1 (Users table) and Table 3 (Picks table) in a "1 to many" relationship on "ID" to filter rows

 

1) How do I relate Table 2 (Time_track table) and Table 3 (Picks table) to filter rows while both of these being related to the Table 1 (Users table)??

 

2) What if I want to show the following in Power BI?

IDUser NameLogin DateTotal_log_time (in min)No_of_sessionsQty_picked
1abc2021-08-02435 990
1abc2021-08-03335250
1abc2021-08-04265660

 

Any suggestions would be helpful.

 

Thanks in advance!

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Set it up like this:

AlexisOlson_0-1637276006475.png

 

With this, it should be drag-and-drop into a table visual:

AlexisOlson_1-1637276179359.png

View solution in original post

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @gunasai ;

As  AlexisOlson said, you could create another table then create a relationship about date.

or you could create a measure as follows:

Measure =
CALCULATE (
    SUM ( 'Table (3)'[Qty_picked] ),
    FILTER (
        'Table (3)',
        [User_id] = MAX ( 'Table (2)'[User Name] )
            && DATEDIFF ( [PickTime], MAX ( 'Table (2)'[Login Date] ), DAY ) = 0
    )
)

The final output is shown below:

vyalanwumsft_0-1637644650376.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

AlexisOlson
Super User
Super User

Set it up like this:

AlexisOlson_0-1637276006475.png

 

With this, it should be drag-and-drop into a table visual:

AlexisOlson_1-1637276179359.png

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.