Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Distinct COuntx

Hi Team, I havae a dataset where i need to get distinct count of projectid where filter condition on cloumn Met/Not Met = "Met" However this dax is not working as i need unique projectid and i am g...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    Create a new table with the following dax expression.

     

    NewTable = 
    SUMMARIZE (
        'Table',
        'Table'[Project ID],
        "Met", CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Met/not met] = "Met" ),
        "Not Met", CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Met/not met] = "Not Met" )
    )

     

    Then create two new columns based on this.

     

    Grand Total = 'NewTable'[Met]+'NewTable'[Not Met]
    Condition = IF('NewTable'[Met]='NewTable'[Grand Total],1,0)

     

    Finally create a measure.

    count 1 = CALCULATE(COUNTROWS('NewTable'),FILTER('NewTable','NewTable'[Condition]=1))

     

    specific value = 
    VAR _condition_all = CALCULATE(COUNTROWS('NewTable'))
    RETURN
    [count 1]/_condition_all

     

    The result should be like this.

    Attach the pbix file for reference. Hope it helps.

     

    Best Regards,
    Community Support Team_Gao


    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!