Forum Discussion

MEHUL123's avatar
MEHUL123
Frequent Visitor
1 year ago
Solved

Conditional distinct count dax

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 ag...
  • Greg_Deckler's avatar
    1 year ago

    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