The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 | ID | Type1 | ID | Type2 | ||
1 | 1 | 1 | 1 | a | ||
2 | 1 | 2 | 2 | a | ||
3 | 2 | 1 | 2 | a | ||
4 | 3 | 1 | 3 | b | ||
5 | 4 | 2 | 4 | b | ||
6 | 5 | 1 | 4 | a | ||
7 | 5 | 1 | 5 | b | ||
8 | 6 | 2 | 6 | a | ||
7 | 1 | 6 | b | |||
8 | 1 | 7 | a | |||
7 | a | |||||
7 | b | |||||
8 | a | |||||
8 | b | |||||
8 | b |
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.
Solved! Go to Solution.
Hi @TBSST
Please try
ID Count =
COUNTROWS (
DISTINCT (
UNION (
CALCULATETABLE ( VALUES ( Table2[ID] ), Table2[Type1] = "1" ),
CALCULATETABLE ( VALUES ( Table3[ID] ), Table3[Type2] = "a" )
)
)
)
Hi @TBSST
Please try
ID Count =
COUNTROWS (
DISTINCT (
UNION (
CALCULATETABLE ( VALUES ( Table2[ID] ), Table2[Type1] = "1" ),
CALCULATETABLE ( VALUES ( Table3[ID] ), Table3[Type2] = "a" )
)
)
)
User | Count |
---|---|
28 | |
11 | |
8 | |
6 | |
5 |
User | Count |
---|---|
35 | |
14 | |
12 | |
9 | |
7 |