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

View all the Fabric Data Days sessions on demand. View schedule

Reply
ddpl
Solution Sage
Solution Sage

Two table common key and relationship issue...

Morning to all,

 

I have 2 tables...

 

Table 1

Client ID-Date-------Key_1
A01-01-22A | 01-01-22
B01-05-22B | 01-05-22
B01-06-22B | 01-06-22
C01-16-22C | 01-16-22
C01-17-22C | 01-17-22
C01-18-22C | 01-18-22

 

Table 2

Client ID-Date-------Key_2
A01-01-22A | 01-01-22
A01-03-22A | 01-03-22
B01-06-22B | 01-06-22
C01-16-22C | 01-16-22
C01-17-22C | 01-17-22

 

Both tables are connected to Key column.

Issue is something like not all the dates from Table 1 is available in Table 2.

So when I put data in Table Visual, I got below...

Client ID(from Table 1)-Count(Table 1)-Count(Table 2)
  1
A11
B21
C32

 

Instead I want below visual...

Client ID(from Table 1)-Count(Table 1)-Count(Table 2)
A12
B21
C32

 

I want count of A... 2, not 1 as shown above.

Concatenation of Client ID & Date is necessary for me.

I have a lot data and this is the simplest explaination to my problem.

 

If anyone have anything to share please,...

2 ACCEPTED SOLUTIONS

@FreemanZ ,

 

Can't do it because Table 1 is the main table which has almost all the data and dates except few of them shown above.

So I have to put Table 1 column first.

 

 

I have changed a bit in question, please check again.

View solution in original post

Anonymous
Not applicable

Hi @ddpl ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can create two measures as below:

Count(Table 1) = 
VAR _selclientid =
    SELECTEDVALUE ( 'Table1'[Client ID] )
VAR _count =
    CALCULATE (
        COUNT ( 'Table1'[Date] ),
        FILTER ( ALLSELECTED ( 'Table1' ), 'Table1'[Client ID] = _selclientid )
    )
RETURN
    _count
Count(Table 2) = 
VAR _selclientid =
    SELECTEDVALUE ( 'Table1'[Client ID] )
VAR _count =
    CALCULATE (
        COUNT ( 'Table2'[Date] ),
        FILTER ( ALLSELECTED ( 'Table2' ), 'Table2'[Client ID] = _selclientid )
    )
RETURN
    _count

yingyinr_0-1669280967810.png

Best Regards

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @ddpl ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can create two measures as below:

Count(Table 1) = 
VAR _selclientid =
    SELECTEDVALUE ( 'Table1'[Client ID] )
VAR _count =
    CALCULATE (
        COUNT ( 'Table1'[Date] ),
        FILTER ( ALLSELECTED ( 'Table1' ), 'Table1'[Client ID] = _selclientid )
    )
RETURN
    _count
Count(Table 2) = 
VAR _selclientid =
    SELECTEDVALUE ( 'Table1'[Client ID] )
VAR _count =
    CALCULATE (
        COUNT ( 'Table2'[Date] ),
        FILTER ( ALLSELECTED ( 'Table2' ), 'Table2'[Client ID] = _selclientid )
    )
RETURN
    _count

yingyinr_0-1669280967810.png

Best Regards

 

FreemanZ
Super User
Super User

try to plot with the Client ID from table2?

@FreemanZ ,

 

Can't do it because Table 1 is the main table which has almost all the data and dates except few of them shown above.

So I have to put Table 1 column first.

 

 

I have changed a bit in question, please check again.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors