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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
manideep547
Helper III
Helper III

Different Customers

Hi all,

I have 4 different tables having the same customers and Id for the  all the 4 tables I need a count of the Ids who belong only to one table 
Example ID 1 having Transaction only on table A but not in Table B, Table C, Table D
Table A                                     Table B                               Table C                            Table D
ID                                                ID                                  ID                                             ID      
111                                            111                                 222                                           333
222                                           333                                  444                                            555
Count=2
111,222,333 Id has a transaction in two tables so we can ignore 
444,555 Id having Transaction only in one table then we have to count those IDS 

1 ACCEPTED SOLUTION
JarroVGIT
Resident Rockstar
Resident Rockstar

Hi @manideep547 ,

 

SingleIDs = 
VAR _unionOfAllTables = UNION(TableA, TableB, TableC, TableD)
VAR _unionWithOccurenceColumn = ADDCOLUMNS(_unionOfAllTables, 
                                "occurences", 
                                VAR _curID = [ID]
                                RETURN
                                COUNTROWS(FILTER(_unionOfAllTables, [ID] = _curID)))
RETURN
COUNTROWS(FILTER(_unionWithOccurenceColumn, [occurences] = 1))

This measure works, see attached PBIX. (please ignore Table1 and Table2, those were for other question).

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

I think that what @amitchandak suggested will work although I did not try its implementation. I went about this a little differently which I believe is more computationally efficient as it avoids measures and table scans, etc. Basically, you need a customer dimension table. Assuming that your actual data is more complex than presented, I did that this way:

 

 

Table = 
    DISTINCT(
        UNION(
            SELECTCOLUMNS('TableA',"ID",'TableA'[ID]),
            SELECTCOLUMNS('TableB',"ID",'TableB'[ID]),
            SELECTCOLUMNS('TableC',"ID",'TableC'[ID]),
            SELECTCOLUMNS('TableD',"ID",'TableD'[ID])
        )
    )

 

 

Now, create relationships based on ID between this table and your other tables. Then just create this column in Table:

 

 

Column = 
    VAR __1 = IF('Table'[ID] IN RELATEDTABLE(TableA),1,0)
    VAR __2 = IF('Table'[ID] IN RELATEDTABLE(TableB),1,0)
    VAR __3 = IF('Table'[ID] IN RELATEDTABLE(TableC),1,0)
    VAR __4 = IF('Table'[ID] IN RELATEDTABLE(TableD),1,0)
RETURN
    IF(__1 + __2 + __3 + __4 = 1,1,0)

 

 

All you need to do now is use Column in any visual with an aggregation of Sum. This method will be far more efficient given large dataset sizes. PBIX is attached.

 

 

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
JarroVGIT
Resident Rockstar
Resident Rockstar

Hi @manideep547 ,

 

SingleIDs = 
VAR _unionOfAllTables = UNION(TableA, TableB, TableC, TableD)
VAR _unionWithOccurenceColumn = ADDCOLUMNS(_unionOfAllTables, 
                                "occurences", 
                                VAR _curID = [ID]
                                RETURN
                                COUNTROWS(FILTER(_unionOfAllTables, [ID] = _curID)))
RETURN
COUNTROWS(FILTER(_unionWithOccurenceColumn, [occurences] = 1))

This measure works, see attached PBIX. (please ignore Table1 and Table2, those were for other question).

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




amitchandak
Super User
Super User

Create a common customer dimension

customer =distinct(union(all(tableA[ID]),all(tableB[ID]),all(tableC[ID]),all(tableD[ID])))

Create a combined measure

measure = count(tableA[ID]) + count (tableB[ID]) + count (tableC[ID]) + count (tableD[ID])

Create 1 transaction measure

Gt 1 = sumx(filter(summarize(customer, customer[ID],"_sum",[measure]),[_sum]<=1),[_sum])
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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