Forum Discussion
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 getting entire count
Kindly help to fix the issue
| Project ID | Met/not met |
| 1289-03 | Not Met |
| 1289-04 | Not Met |
| 1790-01 | Not Met |
| 1898-01 | Not Met |
| 2455-01 | Not Met |
| 2966-01 | Not Met |
| 3319-01 | Not Met |
| 3890-01 | Not Met |
| 4690-01 | Not Met |
| 4721-01 | Not Met |
| 4783-03 | Not Met |
| 5385-01 | Not Met |
| 5571-01 | Not Met |
| 5710-01 | Not Met |
| 5850-01 | Not Met |
| 5952-01 | Not Met |
| 6193-01 | Not Met |
| 1287-05 | Not Met |
| 1293-12 | Not Met |
| 3494-02 | Not Met |
| 3881-02 | Not Met |
| 5450-01 | Not Met |
| 5929-01 | Not Met |
| 6008-01 | Not Met |
| 6211-01 | Not Met |
| 1244-04 | Not Met |
| 1258-10 | Not Met |
| 1293-09 | Not Met |
| 1921-01 | Not Met |
| 4320-01 | Not Met |
| 5800-01 | Not Met |
| 5864-01 | Not Met |
| 6031-08 | Not Met |
| 6259-01 | Not Met |
| 1258-11 | Not Met |
| 1869-01 | Not Met |
| 5450-06 | Not Met |
| 5713-03 | Not Met |
| 6548-01 | Not Met |
| 6826-01 | Not Met |
| 1250-08 | Not Met |
| 1258-06 | Not Met |
| 3101-01 | Not Met |
| 6618-01 | Not Met |
| 6620-01 | Not Met |
| 1267-06 | Not Met |
| 3319-02 | Not Met |
| 4534-01 | Not Met |
| 5472-01 | Not Met |
| 5626-01 | Not Met |
| 5712-01 | Not Met |
| 6546-01 | Not Met |
| 7030-01 | Not Met |
| 7311-01 | Not Met |
| 7469-01 | Not Met |
| 1290-05 | Not Met |
| 6748-01 | Not Met |
| 7472-01 | Not Met |
| 6985-01 | Not Met |
| 7326-01 | Not Met |
| 7380-01 | Not Met |
| 7561-01 | Not Met |
| 7696-01 | Not Met |
| 1869-04 | Not Met |
| 7748-05 | Not Met |
| 8080-01 | Not Met |
| 8524-01 | Not Met |
| 8535-01 | Not Met |
| 7250-05 | Not Met |
| 5772-07 | Not Met |
| 8262-01 | Not Met |
| 8539-01 | Not Met |
| 9211-02 | Not Met |
| 8751-01 | Not Met |
| 10162-01 | Not Met |
| 9757-04 | Not Met |
| 9778-01 | Not Met |
| 9757-01 | Not Met |
| 4768-01 | Not Met |
| 10352-04 | Not Met |
| 10890-01 | Not Met |
| 11365-01 | Not Met |
| 10823-01 | Not Met |
| 10934-01 | Not Met |
| 9542-04 | Not Met |
| 1200-01 | Met |
| 1203-01 | Met |
| 1293-07 | Met |
| 1898-02 | Met |
| 2034-12 | Met |
| 2047-01 | Met |
| 2049-01 | Met |
| 2065-01 | Met |
| 3347-01 | Met |
| 3550-03 | Met |
| 4219-01 | Met |
| 4442-03 | Met |
| 4658-01 | Met |
| 4960-01 | Met |
- Anonymous4 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_allThe 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!
3 Replies
- amitchandakSuper User
Anonymous , Try like
calculate(distinctCOUNT(Table[ProjectId]), filter(Table, Table[ Met/Not Met] = "Met"))
- AnonymousNot applicable
Actually i tried all those steps and it is not matching with the requirement.
Let me rephrase it one more time
Consider below table
Project ID Met Not Met Grand Total Condition = If (Met = Grand Total), 1,0) 10030-01 2 2 1 10077-03 5 5 1 10093-02 8 8 1 10098-01 9 9 1 1010-01 42 42 1 10119-01 13 13 1 10142-01 5 5 1 10162-01 5 2 7 0 10310-02 7 7 1 10331-04 8 8 1 10352-04 2 2 4 0 10376-01 12 12 1 10379-02 5 5 1 Now i want to count how many 1 and total sum i.e, 11/13
- AnonymousNot applicable
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_allThe 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!