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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
TBSST
Frequent Visitor

Calculating distinct count of ID's while meeting either or condition

Hi all, 

 

I am trying to get a distinct total for a card visualtions of ID's that have met either or one of the conditions. My issue is arrising as the conditions sit across different tables and i am unsure how to combine them together without double counting the ID's. 

 

Example: 

Table 1 Table 2  Table 3 
ID IDType1 IDType2
1 11 1a
2 12 2a
3 21 2a
4 31 3b
5 42 4b
6 51 4a
7 51 5b
8 62 6a
  71 6b
  81 7a
     7a
     7b
     8a
     8b
     8b

 

I am wanting to count the distint number of ID's that have had at least one Type 1 '1', and/or at least one Type2 'a'. The ID can have both Types, or just one Type to be counted, although the ID should not be counted twice if they have both. 

 

Any help would be appreciated. 

 

Thank you. 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @TBSST 

Please try

ID Count =
COUNTROWS (
    DISTINCT (
        UNION (
            CALCULATETABLE ( VALUES ( Table2[ID] ), Table2[Type1] = "1" ),
            CALCULATETABLE ( VALUES ( Table3[ID] ), Table3[Type2] = "a" )
        )
    )
)

View solution in original post

1 REPLY 1
tamerj1
Super User
Super User

Hi @TBSST 

Please try

ID Count =
COUNTROWS (
    DISTINCT (
        UNION (
            CALCULATETABLE ( VALUES ( Table2[ID] ), Table2[Type1] = "1" ),
            CALCULATETABLE ( VALUES ( Table3[ID] ), Table3[Type2] = "a" )
        )
    )
)

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.