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,
Request your help to create DAX for Distinct count of IDs against each Name rows in table.
(desired result shown in last colunms)
Name | ID NO. | DAX for Desired Result (Distinct ID against Name) |
Rohan | AA | 2 |
Rohan | BB | 2 |
Rohan | AA | 2 |
Mira | BB | 2 |
John | AA | 1 |
Mira | CC | 2 |
Celvin | AA | 1 |
James | AA | 1 |
Celvin | AA | 1 |
Thanks in advance..
Solved! Go to Solution.
@MEHUL123 Try this. PBIX is attached below signature.
Distinct Count =
VAR __Name = MAX( 'Table'[Name] )
VAR __Table = FILTER( ALLSELECTED( 'Table' ), 'Table'[Name] = __Name )
VAR __Group = SUMMARIZE( __Table, [Name], [ID] )
VAR __Result = COUNTROWS( __Group )
RETURN
__Result
DAX measure:
Distinct ID Count =
CALCULATE(
DISTINCTCOUNT(Table[ID NO.]),
ALLEXCEPT(Table, Table[Name])
)
This will give you the distinct count of ID NO. for each Name.
If this helped, a Kudos 👍 or Solution mark would be great!🎉
Cheers,
Kedar Pande
Connect on LinkedIn
@MEHUL123 Try this. PBIX is attached below signature.
Distinct Count =
VAR __Name = MAX( 'Table'[Name] )
VAR __Table = FILTER( ALLSELECTED( 'Table' ), 'Table'[Name] = __Name )
VAR __Group = SUMMARIZE( __Table, [Name], [ID] )
VAR __Result = COUNTROWS( __Group )
RETURN
__Result
User | Count |
---|---|
28 | |
12 | |
8 | |
7 | |
5 |
User | Count |
---|---|
36 | |
14 | |
12 | |
7 | |
7 |