Forum Discussion
benalfassy
8 years agoRegular Visitor
Help with Filter + Distinct
Hi, I have table with columns "status","ID" I need to count the rows that have "Active" status but with distinct ID and then put it into a new measure. How can i filter my table on "Activ...
- 8 years ago
Please use the DAX below.
Measure 2 = CALCULATE(DISTINCTCOUNT(Table1[ID]),FILTER(Table1,Table1[Status]="Active"))
Regards,
Charlie Liao
- 8 years ago
Hi,
Try this
=CALCULATE(DISTINCTCOUNT(Data[ID]),Data[Status]="Active")
Hope this helps.
benalfassy
8 years agoRegular Visitor
| ID | Status | ||||
| 1 | Active | ||||
| 1 | Active | ||||
| 1 | Not Active | ||||
| 2 | Active | ||||
| 3 | Not Active | ||||
| 2 | Active |
i want to add new measure with value that based on the table above will be 2, because after i filter the Active and remove distinct i will have only 2 rows.
Omega
8 years agoImpactful Individual
Try:
Measure = CALCULATE(COUNTROWS(DISTINCT(Table1[ID])),FILTER(Table1,Table1[Status]="Active"))
- benalfassy8 years agoRegular Visitor
I cant DISTINCT first because i might left with ID that have "Not Active" status although there is ID with Active status
- v-caliao-msft8 years agoMicrosoft Employee
Please use the DAX below.
Measure 2 = CALCULATE(DISTINCTCOUNT(Table1[ID]),FILTER(Table1,Table1[Status]="Active"))
Regards,
Charlie Liao