cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gunasai
Frequent Visitor

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

View solution in original post

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors